public IActionResult Update([FromBody] Models.UserType model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var entity = _repository.GetById(model.Id);

            Mapper.Map <Models.UserType, Entities.UserType>(model, entity);
            _repository.Update(entity);
            return(Ok());;
        }
        // Convert the User type to DbModel User type
        public DbModels.UserType ConvertToDbModelUserType(Models.UserType uType)
        {
            var userType = DbModels.UserType.Technician;

            switch (uType)
            {
            case Models.UserType.Technician:
                userType = DbModels.UserType.Technician;
                break;

            case Models.UserType.Contractor:
                userType = DbModels.UserType.Contractor;
                break;

            default:
                userType = DbModels.UserType.Technician;
                break;
            }
            return(userType);
        }
Beispiel #3
0
 public UserAttribute(Models.UserType usertype)
 {
     RequireUserType = usertype;
 }