public ActionResult ExpandedSettings( string userid, int usertype, string workernumber, string librarynumber, string email, string password1, string password2, string name, string surname, string lastname, string birthday) { var model = new ExpandedSettingsViewModel() { Email = email, Password = password1, Name = name, Surname = surname, LastName = lastname, StringBirthday = birthday, IsPassError = password1 != password2, LibraryNumber = librarynumber, WorkerNumber = workernumber, UserType = (UserType)usertype, UserId = int.Parse(userid) }; if (model.HaveError()) { return(ExpandedSettings(model.UserId, model)); } model.Password = _userService.GetById(model.UserId).Password; // :( _userService.Edit(Mapper.Map <ExpandedSettingsViewModel, User>(model)); return(Redirect("/User/UserList")); }
public ActionResult ExpandedSettings(int id = -1, ExpandedSettingsViewModel setup = null) { if (_auth.User.UserType != UserType.Admin && _auth.User.UserType != UserType.Moderator) { return(HttpNotFound()); } if (setup == null || setup.IsFirstIn) { var user = _userService.GetById(id); var userVm = Mapper.Map <User, UserViewModel>(user); var model = new ExpandedSettingsViewModel() { User = userVm }; model.UserId = id; return(View(model)); } else { return(View(setup)); } }