예제 #1
0
        public ActionResult Put(int id, [FromBody] MedicViewModel userVM)
        {
            // map dto to entity and set id
            var user = _mapper.Map <Medic>(userVM);

            user.ID = id;

            try
            {
                // save
                _userService.Update(user, userVM.Password);
                return(Ok());
            }
            catch (AppException ex)
            {
                // return error message if there was an exception
                return(BadRequest(new { message = ex.Message }));
            }
        }