public static void CreateProducts(ProductsModel entity) { // List<ProductsModel> modellst = new List<ProductsModel>(); var productId = ProductsList.Max(a => a.ProductId) + 1; ProductsList.Add(new ProductsModel { ProductId = productId, ProductName = entity.ProductName, Price = entity.Price, Description = entity.Description }); SessionHelper.SetSession("Products", ProductsList); }
public ActionResult Create(ProductsModel model) { ProductsHelper.CreateProducts(model); ModelState.Clear(); ViewBag.Message = "Products has been added successfully"; return View(); }