Пример #1
0
		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);
		}
Пример #2
0
		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;
			}
		}
Пример #3
0
		public void Insert(Product product)
		{
			int maxId = WebSiteDB.MyNorthwind.Products.Max(x => x.ProductID);
			product.ProductID = maxId + 1;
			WebSiteDB.MyNorthwind.Products.Add(product);
		}
Пример #4
0
		public void Update(Product product)
		{
			product.EnsureItemIsOK();

			BllFactory.GetProductBLL().Update(product);
		}
Пример #5
0
		public void Insert(Product product)
		{
			product.EnsureItemIsOK();

			BllFactory.GetProductBLL().Insert(product);
		}