示例#1
0
        public ActionResult Create(RolesModel model)
        {
            if (model == null)
            {
                return(View(model));
            }
            try
            {
                if (ModelState.IsValid)
                {
                    _setupService.AddRole(model);

                    TempData["Success"] = "Role Created Successfully";

                    return(RedirectToAction("Index", "Role"));
                }

                TempData["Danger"] = "Form Error";
            }
            catch (Exception e)
            {
                TempData["Danger"] = e.Message;
            }

            return(View(@"~\Views\Setup\Role\Index.cshtml", model));
        }