コード例 #1
0
 public ActionResult Create(ECommerce.ViewModels.ProductCategoryCreateViewModel model)
 {
     if (!ModelState.IsValid)
     {
         return(View(model));
     }
     using (var db = new ECommerceDB())
     {
         var category = new Models.ProductCategory
         {
             Name = model.Name,
         };
         db.ProductCategories.Add(category);
         db.SaveChanges();
     }
     return(RedirectToAction("Index", "Home", new { area = "" }));
 }
コード例 #2
0
        public ActionResult Create()
        {
            var model = new ECommerce.ViewModels.ProductCategoryCreateViewModel();

            return(View(model));
        }