コード例 #1
0
 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");
 }
コード例 #2
0
 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();
     }
 }