public ProductInfoModel(List<Category> list, Product product) { if( list == null ) throw new ArgumentNullException("list"); if( product == null ) throw new ArgumentNullException("product"); this.Product = product; this.Categories = ConvertCategoryList(list, product.CategoryID); }
public void Update(Product product) { Product dest = WebSiteDB.MyNorthwind.Products.FirstOrDefault(c => c.ProductID == product.ProductID); if( dest != null ) { dest.ProductName = product.ProductName; dest.CategoryID = product.CategoryID; dest.Quantity = product.Quantity; dest.Remark = product.Remark; dest.Unit = product.Unit; dest.UnitPrice = product.UnitPrice; } }
public void Insert(Product product) { int maxId = WebSiteDB.MyNorthwind.Products.Max(x => x.ProductID); product.ProductID = maxId + 1; WebSiteDB.MyNorthwind.Products.Add(product); }
public void Update(Product product) { product.EnsureItemIsOK(); BllFactory.GetProductBLL().Update(product); }
public void Insert(Product product) { product.EnsureItemIsOK(); BllFactory.GetProductBLL().Insert(product); }