public IHttpActionResult EditUser(int id, [FromBody] EditUserVM updatedUser) { var user = bllModel.GetUserById(id); if (user == null) { return(NotFound()); } if (!string.IsNullOrWhiteSpace(updatedUser.Name)) { user.Name = updatedUser.Name; } if (updatedUser.BirthDate != new DateTime()) { user.BirthDate = updatedUser.BirthDate; } if (bllModel.UpdateUser(user)) { return(Ok()); } return(BadRequest("We can't update user with this parametrs")); }
public ActionResult Edit(EditUserVM user) { if (ModelState.IsValid) { if (bllModel.UpdateUser(user, Request)) { return(RedirectToAction("Index")); } return(View(user)); } return(View(user)); }