public ModifyViewModel BuildViewModel(UserInputModel userInputModel)
 {
     return new ModifyViewModel()
            	{
            		UserInputModel = userInputModel ?? new UserInputModel()
            	};
 }
        public string ProcessAndReturnId(UserInputModel userInputModel)
        {
            var existingUser = userRepository.GetAll().Where(a => a.Id == userInputModel.Id).FirstOrDefault();

            var user = userInputModelToUserMapper.CreateInstance(userInputModel);
            if ((user != null) && (string.IsNullOrEmpty(user.Password)) && (existingUser != null))
                user.Password = existingUser.Password;

            return userRepository.SaveAndReturnId(user);
        }
Пример #3
0
        public ActionResult Modify(UserInputModel userInputModel)
        {
            if (ModelState.IsValid)
            {
                processUserInputModelService.ProcessAndReturnId(userInputModel);
                var routeValues = new RouteValueDictionary();
                routeValues.Add("Controller", "User");
                routeValues.Add("Action", "Modify");
                routeValues.Add("id", userInputModel.Id);

                return new RedirectToRouteResult(routeValues);
            }

            return View("Modify", modifyViewModelBuilder.BuildViewModel(userInputModel));
        }
Пример #4
0
 public ActionResult Create(UserInputModel userInputModel)
 {
     return Modify(userInputModel);
 }
 public string ProcessAndReturnId(UserInputModel userInputModel)
 {
     return userRepository.SaveAndReturnId(userInputModelToUserMapper.CreateInstance(userInputModel));
 }