public ActionResult CreateNewProduct(Product NewProduct) { if (ModelState.IsValid) { NewProduct.CreateProduct(); ViewData["SuccessMessgae"] = "Product Successfully Created"; } return View(NewProduct); }
public static void CreateProduct(Product Product) { lock (IsProductUse) { CurrentProductId++; Product.Id = CurrentProductId; Products.Add(Product.Id, Product); } }