public ActionResult Index(WarehouseAddProductModel model, string returnUrl) { Product product = new Product(); product.Name = model.Name; product.Price = (Decimal) model.Price; product.Quantity = (Decimal)model.Quantity; product.Code = (Int32)model.Code; //Category category = categoryDao.GetCategory((int)model.CategoryId); product.categoryId = (int) model.CategoryId; productDao.Save(product); return View(new WarehouseAddProductModel()); }
public void Save(Product product) { context.Products.Add(product); context.SaveChanges(); }