示例#1
0
        public BoughtProduct UpdateBoughtProduct(BoughtProduct boughtProductChanges)
        {
            var boughtProduct = context.BoughtProducts.Attach(boughtProductChanges);

            boughtProduct.State = EntityState.Modified;
            context.SaveChanges();
            return(boughtProductChanges);
        }
示例#2
0
        public BoughtProduct DeleteBoughtProduct(int id)
        {
            BoughtProduct boughtProduct = context.BoughtProducts.Find(id);

            if (boughtProduct != null)
            {
                context.BoughtProducts.Remove(boughtProduct);
                context.SaveChanges();
            }
            return(boughtProduct);
        }
示例#3
0
        public BoughtProduct DeleteBoughtProduct(string userId, int productId)
        {
            BoughtProduct boughtProduct = (from bp in context.BoughtProducts
                                           where bp.AppUserRefId == userId && bp.ProductRefId == productId
                                           select bp).FirstOrDefault();

            if (boughtProduct != null)
            {
                context.BoughtProducts.Remove(boughtProduct);
                context.SaveChanges();
            }
            return(boughtProduct);
        }
示例#4
0
 public BoughtProduct AddBoughtProduct(BoughtProduct boughtProduct)
 {
     throw new NotImplementedException();
 }
示例#5
0
 public BoughtProduct UpdateBoughtProduct(BoughtProduct boughtProductChanges)
 {
     throw new NotImplementedException();
 }
示例#6
0
 public BoughtProduct AddBoughtProduct(BoughtProduct boughtProduct)
 {
     context.BoughtProducts.Add(boughtProduct);
     context.SaveChanges();
     return(boughtProduct);
 }