示例#1
0
        public ActionResult Create(AdminRole model, FormCollection form)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    model.UpdatePermissions(GetPermissions(form));

                    DataContext.AdminRoles.Add(model);
                    SaveChanges();

                    ShowSuccess(MessageResource.CreateSuccess);

                    return(RedirectToIndex());
                }
                catch
                {
                    ShowError(MessageResource.CreateFailed);
                }
            }

            return(View(model));
        }