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 = "" })); }
public ActionResult Create() { var model = new ECommerce.ViewModels.ProductCategoryCreateViewModel(); return(View(model)); }