Пример #1
0
 public ActionResult Index(string action, IPModel[] list)
 {
     if (action == "delete") return Delete(list);
     if (action == "new") return Create();
     ModelState.AddModelError("", Resources.IPController.InvalidAction);
     var vm = new IdentityProvidersViewModel(this.identityProviderRepository);
     return View("Index", vm);
 }
Пример #2
0
 ActionResult Delete(IPModel[] list)
 {
     if (ModelState.IsValid)
     {
         try
         {
             if (list != null)
             {
                 foreach (var item in list.Where(x => x.Delete))
                 {
                     this.identityProviderRepository.Delete(item.ID);
                 }
                 TempData["Message"] = Resources.IPController.IdentityProvidersDeleted;
             }
             return RedirectToAction("Index");
         }
         catch (ValidationException ex)
         {
             ModelState.AddModelError("", ex.Message);
         }
         catch
         {
             ModelState.AddModelError("", Resources.IPController.ErrorDeletingIdentityProviders);
         }
     }
     var vm = new IdentityProvidersViewModel(this.identityProviderRepository);
     return View("Index", vm);
 }
Пример #3
0
 public ActionResult Index()
 {
     var vm = new IdentityProvidersViewModel(this.identityProviderRepository);
     return View("Index", vm);
 }
Пример #4
0
 public ActionResult Menu()
 {
     var list = new IdentityProvidersViewModel(this.identityProviderRepository);
     if (list.IdentityProviders.Any())
     {
         var vm = new ChildMenuViewModel
         {
             Items = list.IdentityProviders.Select(x =>
                 new ChildMenuItem
                 {
                     Controller = "IP",
                     Action = "IP",
                     Title = x.Name,
                     RouteValues = new { id = x.ID }
                 }).ToArray()
         };
         return PartialView("ChildMenu", vm);
     }
     return new EmptyResult();
 }