public ActionResult EditProfile(ProfileModel input) { if (LoggedUser.Id != input.Id) throw new Exception("Your are not allowed to modify somebodies' else profile"); if (ModelState.IsValid) { var editProfileCommand = Mapper.Map<EditProfileCommand>(input); CommandProcessor.Process(editProfileCommand); if (editProfileCommand.IsValid) { _loggedUserService.RefreshLoggedUserInformation(); input.Password = input.ValidatePassword = string.Empty; Notify("Your profile has been succesfully updated", NotifyType.Success, NotifyPosition.Top); return View(input); } } input.Password = input.ValidatePassword = string.Empty; return View(input); }
public ActionResult Register(ProfileModel input) { if (ModelState.IsValid) { var registerUserCommand = Mapper.Map<RegisterUserCommand>(input); CommandProcessor.Process(registerUserCommand); if (registerUserCommand.IsValid) { return Login(Mapper.Map<LoginModel>(input)); } } input.Password = string.Empty; return View(input); }