Пример #1
0
        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);
        }
Пример #2
0
        public ActionResult Add()
        {
            var addUsersModel = new AddUserModel
            {
                RoleId = ConstDefaultRoleId
            };

            return View(addUsersModel);
        }