public ActionResult Delete(int?id) { try { BatchRepo.DeleteConfirmed(id); } catch (Exception) { ViewData["ErrorMsg"] = "Failed to delete batch."; } return(Redirect("/batch")); }