コード例 #1
0
 public ActionResult CategoryCreate(string title)
 {
     if (ModelState.IsValid)
     {
         var category = new CategoryLogic();
         category.CreateNewCategory(title);
         return RedirectToAction("Categories");
     }
     return View();
 }
コード例 #2
0
 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);
 }
コード例 #3
0
 public ActionResult CategoryDelete(Category category)
 {
     var categoryService = new CategoryLogic();
     categoryService.DeleteCategory(category.CategoryId);
     return RedirectToAction("Categories");
 }
コード例 #4
0
 public ActionResult Categories()
 {
     var categories = new CategoryLogic();
     return View(categories.ToList());
 }
コード例 #5
0
 // 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);
 }
コード例 #6
0
        // GET: StoreManager/Create
        public ActionResult ProductCreate()
        {
            var categoryList = new CategoryLogic();
            ViewBag.CategoryId = categoryList.SetCategoryViewBag();

            return View();
        }