Exemplo n.º 1
0
        public IActionResult Put(int id, [FromBody] JObject value)
        {
            if (value == null)
            {
                return(BadRequest());
            }

            try
            {
                var userVm = value.ToObject <UserViewModel>();
                var user   = _mapper.Map <UserEntity>(userVm);

                var result = _userBll.ChangeUser(id, user);

                if (id == -1)
                {
                    return(BadRequest());
                }

                return(Ok(new { result }));
            }
            catch
            {
                return(BadRequest());
            }
        }