public int AddService(string name, string unit,int? productGroupId) { Product newService = new Product { Name = name, Unit = unit, IsService = true, ProductGroupId = productGroupId }; db.Products.InsertOnSubmit(newService); Save(); return newService.Id; }
public int AddProduct(int? productGroupId,string barcode,string name, string unit,decimal price) { Product newProduct = new Product { Name = name, Unit = unit, IsService = false, BarCode = barcode, ProductGroupId = productGroupId }; newProduct.Prices.Add(new Price { Amount = price, Date = DateTime.Now }); db.Products.InsertOnSubmit(newProduct); Save(); return newProduct.Id; }
partial void DeleteProduct(Product instance);
partial void UpdateProduct(Product instance);
partial void InsertProduct(Product instance);
private void detach_Products(Product entity) { this.SendPropertyChanging(); entity.ProductGroup = null; }
private void attach_Products(Product entity) { this.SendPropertyChanging(); entity.ProductGroup = this; }