예제 #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);
		}