private ActionResult Delete(OAuthClientIndexInputModel[] list) { if (ModelState.IsValid) { try { foreach (var client in list.Where(x => x.Delete)) { this.clientRepository.Delete(client.ID); } TempData["Message"] = Resources.OAuthClientController.ClientsDeleted; return RedirectToAction("Index"); } catch (ValidationException ex) { ModelState.AddModelError("", ex.Message); } catch (Exception) { ModelState.AddModelError("", Resources.OAuthClientController.ErrorDeletingClients); } } return Index(); }
public ActionResult Index(string action, OAuthClientIndexInputModel[] list) { if (action == "new") return RedirectToAction("Edit"); if (action == "delete") return Delete(list); ModelState.AddModelError("", Resources.OAuthClientController.InvalidAction); return Index(); }