public ActionResult Delete(Category categoryToDelete) { //CategoryRepository catRep = new CategoryRepository(); try { catRep.DeleteCategory(categoryToDelete.RowKey); } catch { ViewData["Message"] = "Sorry, We are unable to delete the specified record"; return RedirectToAction("Index"); } ViewData["Message"] = "The specified category deleted successfully"; return RedirectToAction("Index"); }
public ActionResult Create(FormCollection form) { try { //CategoryRepository catRep = new CategoryRepository(); Category cat = new Category(); cat.Name = form["Name"]; cat.PartitionKey = String.IsNullOrEmpty(form["lstCategories"]) ? String.Empty : form["lstCategories"]; catRep.AddCategory(cat); return RedirectToAction("Index"); } catch { return View(); } }