コード例 #1
0
        public ActionResult Apply(string id)
        {
            if (User.Identity.IsAuthenticated)
            {
                List <Privilege>      privileges    = StatementManager.GetAllPrivileges();
                List <Group>          groups        = StatementManager.GetAllGroups();
                List <Kindergarten>   Kindergartens = KindergartenManager.GetKindergartens().ToList();
                AddStatementViewModel model         = new AddStatementViewModel {
                };
                model.Privileges = new List <PrivilegesInnerViewModel> {
                };
                model.Groups     = new List <string> {
                };
                for (int i = 0; i < privileges.Count; i++)
                {
                    model.Privileges.Add(new PrivilegesInnerViewModel {
                        Key = privileges[i].Value, Value = false
                    });
                }
                for (int i = 0; i < groups.Count; i++)
                {
                    model.Groups.Add(groups[i].Value);
                }

                model.Kindergartens = new SelectList(Kindergartens, "Id", "Name");

                return(View(model));
            }
            return(RedirectToAction("Index", "Home"));
        }
コード例 #2
0
 public ActionResult Groups()
 {
     if (User.Identity.IsAuthenticated && User.IsInRole("Admin"))
     {
         List <Group> groups = StatementManager.GetAllGroups();
         return(View(groups));
     }
     return(RedirectToAction("Index", "Home"));
 }