public ActionResult CategoryCreate(string title) { if (ModelState.IsValid) { var category = new CategoryLogic(); category.CreateNewCategory(title); return RedirectToAction("Categories"); } return View(); }
public ActionResult CategoryDelete(int? id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } var categoryService = new CategoryLogic(); Category category = categoryService.FindCategory(id); if (category == null) { return HttpNotFound(); } return View(category); }
public ActionResult CategoryDelete(Category category) { var categoryService = new CategoryLogic(); categoryService.DeleteCategory(category.CategoryId); return RedirectToAction("Categories"); }
public ActionResult Categories() { var categories = new CategoryLogic(); return View(categories.ToList()); }
// GET: StoreManager/Product/Edit/5 public ActionResult ProductEdit(int? id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } var productService = new ProductLogic(); Product product = productService.FindProduct(id); if (product == null) { return HttpNotFound(); } var categoryList = new CategoryLogic(); ViewBag.CategoryId = categoryList.SetCategoryViewBag(id); return View(product); }
// GET: StoreManager/Create public ActionResult ProductCreate() { var categoryList = new CategoryLogic(); ViewBag.CategoryId = categoryList.SetCategoryViewBag(); return View(); }