예제 #1
0
        public ActionResult List(int id)
        {
            var vm = new UnionsForm {
                SectionId = id
            };

            if (User.IsInAnyRole(AppRole.Workers))
            {
                switch (usersRepo.GetTopLevelJob(base.AdminId))
                {
                case JobRole.UnionManager:
                    vm.UnionsList = new UnionsRepo().GetByManagerId(base.AdminId);
                    break;

                case JobRole.LeagueManager:
                    break;

                case JobRole.TeamManager:
                    break;
                }
            }
            else
            {
                vm.UnionsList = unionsRepo.GetBySection(id);
            }

            return(PartialView("_List", vm));
        }
예제 #2
0
        public ActionResult Save(UnionsForm frm)
        {
            var u = new Union {
                SectionId = frm.SectionId, Name = frm.Name
            };

            unionsRepo.Create(u);
            unionsRepo.Save();

            return(RedirectToAction("List", new { id = frm.SectionId }));
        }