public IActionResult Create(ProductType productType) { if (ModelState.IsValid) { _context.Create(productType); return(RedirectToAction(nameof(Index))); } return(View(productType)); }
public IActionResult Add(ProductType productTypeVM) { ProductType isValidName = _database.Find(s => s.ProductTypeName == productTypeVM.ProductTypeName && s.IsDeleted == false).FirstOrDefault(); if (isValidName != null) { return(View()); } if (ModelState.IsValid) { ProductType newType = new ProductType(); newType.ProductTypeName = productTypeVM.ProductTypeName; newType.IsDeleted = false; _database.Create(newType); return(RedirectToAction("Index", "ProductType")); } else { return(View(productTypeVM)); } }
public ProductType CreateProductType(ProductType productType) { return(_prodTypeRepo.Create(productType)); }