// CreateOne saves provided model instance to database
CreateOne saves provided model instance to database
// CreateOne saves provided model instance to database
func (this *RoleService) CreateOne(request *mrequest.RoleCreate) (*models.Role, *mresponse.ErrorResponse) {
	err := errors.ValidateRequest(request)
	if err != nil {
		return nil, err
	}
	_, e := this.repository.CreateOne(request)
	if e != nil {
		errR := errors.HandleErrorResponse(errors.SERVICE_UNAVAILABLE, nil, e.Error())
		return nil, errR
	}
	result := models.Role{
		Role: request.Role,
		Level: request.Level,
	}
	return &result, nil
}
func ( this * RoleService ) CreateOne ( request * mrequest . RoleCreate ) ( * models . Role , * mresponse . ErrorResponse ) { err := errors . ValidateRequest ( request ) if err != nil { return nil , err } _ , e := this . repository . CreateOne ( request ) if e != nil { errR := errors . HandleErrorResponse ( errors . SERVICE_UNAVAILABLE , nil , e . Error ( ) ) return nil , errR } result := models . Role { Role : request . Role , Level : request . Level , } return & result , nil }
CreateOne saves provided model instance to database
CreateOne saves provided model instance to database
// validate request