Ejemplo n.º 1
0
        public IHttpActionResult Put(string id, [FromBody] User user)
        {
            if (string.IsNullOrEmpty(id) || !userModel.UserExist(id))
            {
                return(NotFound());
            }

            if (userModel.UpdateUser(id, AutoMapper.Mapper.Map <Objects.User>(user)))
            {
                user.Password = null;
                return(Content(HttpStatusCode.Accepted, user));
            }
            else
            {
                return(InternalServerError());
            }
        }
Ejemplo n.º 2
0
 public IActionResult UpdateUser([FromBody] Users user)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             return(BadRequest(ModelState));
         }
         bool status = UserModal.UpdateUser(user);
         if (status)
         {
             return(Ok());
         }
         else
         {
             return(NotFound());
         }
     }
     catch (Exception ex) { return(BadRequest(ex)); }
 }