コード例 #1
0
ファイル: ProductManager.cs プロジェクト: JSzymczuk/GameStore
 public void CreateCategory(ProductCategory category)
 {
     if (category != null)
     {
         Context.ProductCategories.Add(category);
     }
 }
コード例 #2
0
ファイル: ProductManager.cs プロジェクト: JSzymczuk/GameStore
 public void UpdateCategory(ProductCategory category)
 {
     if (category != null)
     {
         Context.Entry(category).State = EntityState.Modified;
     }
 }
コード例 #3
0
        public ActionResult Create(CategoryViewModel model)
        {
            if (ModelState.IsValid)
            {
                var category = new ProductCategory
                {
                     Name = model.Name,
                     NameShort = model.NameShort,
                     ParentId = model.ParentId
                };
                ProductManager.CreateCategory(category);
                ProductManager.Save();

                return RedirectToAction("Index");
            }
            return View(model);
        }