Updates the title-specific custom data for the user which is readable and writable by the client
Inheritance: Command
Beispiel #1
0
 private void UpdateUserEntity(User user, UpdateUserDataCommand command)
 {
     user.FirstName = command.FirstName;
     user.LastName  = command.LastName;
     user.Login     = command.Login;
     user.Phone     = command.Phone;
 }
Beispiel #2
0
        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();
            }
        }
Beispiel #3
0
 protected void UpdateUserDataCommandHandler(UpdateUserDataCommand cmd)
 {
     _backendService.UpdateUserData(cmd.UserID, cmd.Data);
 }
        public ActionResult ChangeData(UpdateUserDataCommand command)
        {
            HandleCommand(command, Json("User updated"));

            return(RedirectToAction("Index"));
        }