public IActionResult PutUser(string id, [FromBody] ApplicationUser entity) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (!id.Equals(entity.Id, StringComparison.Ordinal)) { return(BadRequest()); } try { _userService.Update(id, entity); } catch (DbUpdateConcurrencyException) { if (!_userService.ApplicationUserExists(id)) { return(NotFound()); } else { throw new AppException("Update failed"); } } return(NoContent()); }