private ActionResult Delete(OAuthClientInputModel[] list) { if (ModelState.IsValid) { try { foreach (var client in list.Where(x => x.Delete)) { this.clientRepository.Delete(client.ID); } TempData["Message"] = "Clients Deleted"; return RedirectToAction("Index"); } catch (ValidationException ex) { ModelState.AddModelError("", ex.Message); } catch (Exception) { ModelState.AddModelError("", "Error deleting clients."); } } return Index(); }
public ActionResult Index(string action, OAuthClientInputModel[] list) { if (action == "new") return RedirectToAction("Edit"); if (action == "delete") return Delete(list); ModelState.AddModelError("", "Invalid Action"); return Index(); }