private void UpdateUserEntity(User user, UpdateUserDataCommand command) { user.FirstName = command.FirstName; user.LastName = command.LastName; user.Login = command.Login; user.Phone = command.Phone; }
public void Handle(UpdateUserDataCommand command) { ValidatePhoneNumber(command.Phone); using (var dbContext = new UserAccountDataContext()) { User user = dbContext.Users.Single(u => u.Id == command.Id); if (user == null) { throw new ServerSideException("Ups, something went wrong! Refresh page and try agine"); } UpdateUserEntity(user, command); dbContext.SaveChanges(); } }
protected void UpdateUserDataCommandHandler(UpdateUserDataCommand cmd) { _backendService.UpdateUserData(cmd.UserID, cmd.Data); }
public ActionResult ChangeData(UpdateUserDataCommand command) { HandleCommand(command, Json("User updated")); return(RedirectToAction("Index")); }