public ActionResult Add(AddUserModel addUsersModel) { if (ModelState.IsValid) { Mapper.CreateMap<AddUserModel, UserContactDetailsDto>(); var userInsertDetailsDto = Mapper.Map<AddUserModel, UserContactDetailsDto>(addUsersModel); IList<string> errorMessages = new List<string>(); if (!_userService.Insert( userInsertDetailsDto, CurrentUser.UserId, ref errorMessages)) { ModelState.AddModelErrors(errorMessages); } else { return RedirectToAction("AddSuccessful", new { id = userInsertDetailsDto.UserId }); } } // Reaching this point means something went wrong. return View(addUsersModel); }
public ActionResult Add() { var addUsersModel = new AddUserModel { RoleId = ConstDefaultRoleId }; return View(addUsersModel); }