Exemplo n.º 1
0
        public ActionResult Create(AdminUserMembershipModel model)
        {
            if (!this.ModelState.IsValid)
                return this.View("Create", model);

            var user = this.ObjectMapper.DoMapping<AdminUser>(model);

            OperationResult<OperationResults, int?> rslt = null;

            try
            {
                rslt = this.UserRepository.CreateUser(this.CurrentUser.ID, user);
            }
            catch (Exception ex)
            {
                this.Logger.WriteError(ex);
            }

            if (rslt == null || rslt.Result != OperationResults.Success)
            {
                this.ModelState.AddModelError(string.Empty, "User was not created due to server error");
                return this.View("Create", model);
            }

            return this.RedirectToAction("Index", "User");
        }
Exemplo n.º 2
0
 public ActionResult Create()
 {
     var model = new AdminUserMembershipModel()
     {
         IsActive = true,
         Roles = AdminUserRoles.Admin
     };
     return View("Create", model);
 }