Example #1
0
 public void CreateShopping(DateTime date)
 {
     DBO.Shopping Shopping = new DBO.Shopping
     {
         id   = Guid.NewGuid(),
         date = date
     };
     DBO.DatabaseContext.getInstance().Shoppings.Add(Shopping);
     DBO.DatabaseContext.getInstance().SaveChanges();
 }
Example #2
0
 public bool DeleteShopping_Product(DBO.Shopping shopping, DBO.Product product)
 {
     DBO.Shopping_Product exists = GetShopping_ProductForShoppingAndProduct(shopping, product);
     if (exists == null)
     {
         return(false);
     }
     DBO.DatabaseContext.getInstance().Shopping_Product.Remove(exists);
     return(true);
 }
Example #3
0
 public bool DeleteShoppingFromId(Guid id)
 {
     DBO.Shopping exists = DBO.DatabaseContext.getInstance().Shoppings.FirstOrDefault(s => s.id == id);
     if (exists == null)
     {
         return(false);
     }
     DBO.DatabaseContext.getInstance().Shoppings.Remove(exists);
     DBO.DatabaseContext.getInstance().SaveChanges();
     return(true);
 }
Example #4
0
 public bool DeleteShopping(DateTime date)
 {
     DBO.Shopping exists = DBO.DatabaseContext.getInstance().Shoppings.FirstOrDefault(s => s.date == date);
     if (exists == null)
     {
         return(false);
     }
     DBO.DatabaseContext.getInstance().Shoppings.Remove(exists);
     DBO.DatabaseContext.getInstance().SaveChanges();
     return(true);
 }
Example #5
0
 public void CreateShopping_Product(DBO.Product product, DBO.Shopping shopping, int number)
 {
     DBO.Shopping_Product Shopping_Product = new DBO.Shopping_Product
     {
         id_shopping = shopping.id,
         id_product  = product.id,
         number      = number,
         Product     = product,
         Shopping    = shopping
     };
     DBO.DatabaseContext.getInstance().Shopping_Product.Add(Shopping_Product);
     DBO.DatabaseContext.getInstance().SaveChanges();
 }
Example #6
0
        public void CreateShoppingWithProducts(DateTime date, List <DBO.Shopping_Product> shopping_products)
        {
            Guid id = Guid.NewGuid();

            DBO.Shopping Shopping = new DBO.Shopping
            {
                id   = id,
                date = date
            };
            foreach (DBO.Shopping_Product shopping_product in shopping_products)
            {
                shopping_product.id_shopping = id;
            }
            Shopping.Shopping_Product = shopping_products;
            DBO.DatabaseContext.getInstance().Shoppings.Add(Shopping);
            DBO.DatabaseContext.getInstance().SaveChanges();
        }
Example #7
0
 public DBO.Shopping_Product GetShopping_ProductForShoppingAndProduct(DBO.Shopping shopping, DBO.Product product)
 {
     return(DBO.DatabaseContext.getInstance().Shopping_Product.FirstOrDefault(sp => shopping.id == sp.id_shopping && sp.id_product == product.id));
 }
Example #8
0
 public List <DBO.Shopping_Product> GetShopping_ProductsForShopping(DBO.Shopping shopping)
 {
     return(DBO.DatabaseContext.getInstance().Shopping_Product.Where(sp => sp.id_shopping == shopping.id).ToList());
 }
Example #9
0
 public List <DBO.Shopping_Product> GetShopping_ProductsForShopping(DBO.Shopping shopping)
 {
     return(shopping_product.GetShopping_ProductsForShopping(shopping));
 }
Example #10
0
 public DBO.Shopping_Product GetShopping_ProductForShoppingAndProduct(DBO.Shopping shopping, DBO.Product product)
 {
     return(shopping_product.GetShopping_ProductForShoppingAndProduct(shopping, product));
 }
Example #11
0
 public bool DeleteShopping_Product(DBO.Shopping shopping, DBO.Product product)
 {
     return(shopping_product.DeleteShopping_Product(shopping, product));
 }
Example #12
0
 public void CreateShopping_Product(DBO.Product product, DBO.Shopping shopping, int number)
 {
     shopping_product.CreateShopping_Product(product, shopping, number);
 }