public int Update(LiveMedsEntity.Product product)
        {
            LiveMedsEntity.Product ad = this.context.Products.SingleOrDefault(a => a.ProductId == product.ProductId);

            ad.CategoryId         = product.CategoryId;
            ad.ManufacturerId     = product.ManufacturerId;
            ad.ProductBuyingPrice = product.ProductBuyingPrice;
            ad.ProductDescription = product.ProductDescription;
            ad.ProductFormulation = product.ProductFormulation;
            if (product.ProductImagePath != null)
            {
                ad.ProductImagePath = product.ProductImagePath;
            }
            ad.ProductName          = product.ProductName;
            ad.ProductPackagingType = product.ProductPackagingType;
            ad.ProductQuantity      = product.ProductQuantity;
            ad.ProductSellingPrice  = product.ProductSellingPrice;
            ad.ProductSold          = product.ProductSold;
            return(this.context.SaveChanges());
        }
Esempio n. 2
0
 public int Update(LiveMedsEntity.Product value)
 {
     return(this.data.Update(value));
 }
Esempio n. 3
0
 public int Insert(LiveMedsEntity.Product value)
 {
     return(this.data.Insert(value));
 }
 public int Delete(int id)
 {
     LiveMedsEntity.Product ad = this.context.Products.SingleOrDefault(a => a.ProductId == id);
     this.context.Products.Remove(ad);
     return(this.context.SaveChanges());
 }
 public int Insert(LiveMedsEntity.Product product)
 {
     this.context.Products.Add(product);
     return(this.context.SaveChanges());
 }