コード例 #1
0
 public ActionResult Menu()
 {
     var rpvm = new RelyingPartiesViewModel(RelyingPartyRepository);
     var list = rpvm.RPs.Where(x => x.Enabled);
     if (list.Any())
     {
         var vm = new ChildMenuViewModel
         {
             Items = list.Select(x=>
                 new ChildMenuItem
                 {
                     Controller = "RP",
                     Action = "RP",
                     Title = x.DisplayName,
                     RouteValues = new{id=x.ID}
                 }).ToArray()
         };
         return PartialView("ChildMenu", vm);
     }
     return new EmptyResult();
 }
コード例 #2
0
        public ActionResult Index(string action, IEnumerable<RelyingPartyViewModel> list)
        {
            if (action == "save")
            {
                var vm = new RelyingPartiesViewModel(RelyingPartyRepository);
                if (ModelState.IsValid)
                {
                    vm.Update(list);
                    TempData["Message"] = Resources.RPController.UpdateSuccessful;
                    return RedirectToAction("Index");
                }

                return View("Index", vm);
            }

            if (action == "new")
            {
                return RedirectToAction("RP");
            }

            ModelState.AddModelError("", Resources.RPController.InvalidAction);
            return View("Index", new RelyingPartiesViewModel(RelyingPartyRepository));
        }
コード例 #3
0
 public ActionResult Index()
 {
     var vm = new RelyingPartiesViewModel(RelyingPartyRepository);
     return View("Index", vm);
 }