Пример #1
0
 public void UpdateProduct(Product product)
 {
     using (var context = new CBContext())
     {
         //context.Entry(product.Category).State = EntityState.Modified;
         context.Entry(product).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
Пример #2
0
        public List <Product> GetProducts(int pageNo)
        {
            int pageSize = 10;

            using (var context = new CBContext())
            {
                return(context.Products.OrderBy(x => x.ID).Skip((pageNo - 1) * pageSize).Take(pageSize).Include(x => x.Category).ToList());
            }
        }
Пример #3
0
 public void DeleteCategory(int ID)
 {
     using (CBContext db = new CBContext())
     {
         var category = db.Categories.Find(ID);
         db.Categories.Remove(category);
         db.SaveChanges();
     }
 }
Пример #4
0
 public void SaveDrug(Drug product)
 {
     using (var context = new CBContext())
     {
         // context.Entry(product.catagory).State = System.Data.Entity.EntityState.Unchanged;
         context.Drugs.Add(product);
         context.SaveChanges();
     }
 }
 public void DeleteStudent(Student product)
 {
     using (var context = new CBContext())
     {
         context.Entry(product).State = System.Data.Entity.EntityState.Deleted;
         //context.catagories.Remove(catagory);
         context.SaveChanges();
     }
 }
Пример #6
0
 public void DeleteProduct(int id)
 {
     using (CBContext context = new CBContext())
     {
         Product product = context.Products.Find(id);
         context.Products.Remove(product);
         context.SaveChanges();
     }
 }
Пример #7
0
 public int SaveOrder(Order p)
 {
     using (var context = new CBContext())
     {
         //context.Entry(p.IdCat).State = System.Data.Entity.EntityState.Unchanged;
         context.Orders.Add(p);
         return(context.SaveChanges());
     }
 }
Пример #8
0
        public void UpdateCategory(Category category)
        {
            using (var context = new CBContext())
            {
                context.Entry(category).State = System.Data.Entity.EntityState.Modified;

                context.SaveChanges();
            }
        }
 public void DeleteCategory(int ID)
 {
     using (var context = new CBContext())
     {
         var category = context.Categories.Find(ID);
         context.Categories.Remove(category);
         context.SaveChanges();
     }
 }
Пример #10
0
 public void SaveProduct(Product product)
 {
     using (var context = new CBContext())
     {
         context.Entry(product.Category).State = System.Data.Entity.EntityState.Unchanged;
         context.Products.Add(product);
         context.SaveChanges();
     }
 }
Пример #11
0
        public int PageSize()
        {
            using (var context = new CBContext())
            {
                var pageSizeConfig = context.Configurations.Find("PageSize");

                return(pageSizeConfig != null?int.Parse(pageSizeConfig.Value) : 5);
            }
        }
Пример #12
0
        public void SaveCategory(Category category)
        {
            using (var context = new CBContext())
            {
                context.Categories.Add(category);

                context.SaveChanges();
            }
        }
Пример #13
0
 public void DeleteProduct(int ID)
 {
     using (var context = new CBContext())
     {
         var product = context.Products.Find(ID);
         context.Products.Remove(product);
         context.SaveChanges();
     }
 }
Пример #14
0
        /////////////////////////////////////////////////////////////////////////////////////////////////////// Update Products Single based on id
        public void UpdateProducts(Product product)
        {
            using (var context = new CBContext())
            {
                context.Entry(product).State = System.Data.Entity.EntityState.Modified;

                context.SaveChanges();
            }
        }
Пример #15
0
 public void DeleteProduct(DispensaryServices product)
 {
     using (var context = new CBContext())
     {
         context.Entry(product).State = System.Data.Entity.EntityState.Deleted;
         //context.catagories.Remove(catagory);
         context.SaveChanges();
     }
 }
Пример #16
0
        public void DeleteProduct(int ID)
        {
            using (var context = new CBContext())
            {
                var productToRemove = context.Products.Find(ID); // find the category to remove based on the ID parameter

                context.Products.Remove(productToRemove);        // remove that category
                context.SaveChanges();
            }
        }
Пример #17
0
        public List <AppointmentList> GetAppiontmentLists(int pageNo)
        {
            int pageSize = 6;

            using (var context = new CBContext())
            {
                return(context.AppointmentList.OrderByDescending(x => x.Id).Skip((pageNo - 1) * pageSize).Take(pageSize).ToList());
                // return context.products.Include(x => x.catagory).ToList();
            }
        }
Пример #18
0
        public void DeleteWishlist(int ID)
        {
            using (var context = new CBContext())
            {
                var Wishlist = context.wishlist.Find(ID);

                context.wishlist.Remove(Wishlist);
                context.SaveChanges();
            }
        }
Пример #19
0
        public int ShopPageSize()
        {
            using (var context = new CBContext())
            {
                // var pageSizeConfig = context.configurations.Find("ShopPageSize");

                // return pageSizeConfig != null ? int.Parse(pageSizeConfig.Value) : 6;
                return(6);
            }
        }
Пример #20
0
 public void DeleteCategory(int ID)
 {
     using (var context = new CBContext())
     {
         var category = context.Categories.Where(x => x.ID == ID).Include(x => x.Products).FirstOrDefault();
         context.Products.RemoveRange(category.Products);
         context.Categories.Remove(category);
         context.SaveChanges();
     }
 }
Пример #21
0
 public void DeleteProduit(int p)
 {
     using (var context = new CBContext())
     {
         //context.Entry(cat).State = System.Data.Entity.EntityState.Deleted;
         var produit = context.Produits.Find(p);
         context.Produits.Remove(produit);
         context.SaveChanges();
     }
 }
        public List <PurchaseProductsMaster> GetAllPurchaseRecordsByDate(string datefrom, string dateto)
        {
            DateTime fDate = Convert.ToDateTime(datefrom);
            DateTime tDate = Convert.ToDateTime(dateto).AddDays(1);

            using (var context = new CBContext())
            {
                return(context.PurchaseProductMaster.Where(x => x.Date >= fDate && x.Date <= tDate).ToList());
            }
        }
Пример #23
0
        public List <Drug> GetDrugs()
        {
            int pageSize = 6;

            using (var context = new CBContext())
            {
                return(context.Drugs.OrderByDescending(x => x.Id).ToList());
                // return context.products.Include(x => x.catagory).ToList();
            }
        }
 public bool UpdateOrderStatus(int ID, string status)
 {
     using (var context = new CBContext())
     {
         var order = context.Orders.Find(ID);
         order.Status = status;
         context.Entry(order).State = EntityState.Modified;
         return(context.SaveChanges() > 0);
     }
 }
Пример #25
0
        ///////////////////////////////////////////////////////////////////////// Send sigle Product id to Server and find
        public Product GetProduct(int ID)
        {
            using (var context = new CBContext())
            {
                return(context.Products.Where(x => x.ID == ID).Include(x => x.Category).FirstOrDefault());

                // return context.Products.Find(ID);
                //return context.Products.Where(x => x.ID == ID).Include(x => x.Category).FirstOrDefault();
            }
        }
Пример #26
0
        public List <DispensaryServices> GetDispensaryDrugs(int pageNo)
        {
            int pageSize = 6;

            using (var context = new CBContext())
            {
                return(context.DispensaryServices.OrderByDescending(x => x.Id).Skip((pageNo - 1) * pageSize).Take(pageSize).ToList());
                // return context.products.Include(x => x.catagory).ToList();
            }
        }
Пример #27
0
 public void DeleteCategory(int ID)
 {
     using (var context = new CBContext())
     {
         //context.Entry(category).State = System.Data.Entity.EntityState.Deleted;
         var category = context.categories.Find(ID);
         context.categories.Remove(category);
         context.SaveChanges();
     }
 }
Пример #28
0
 public Category GetCategory(int id)
 {
     using (CBContext db = new CBContext()) {
         return(db.Categories.Find(id));
     }
     //using (var context = new CBContext())
     //{
     //    return context.Categories.Find(id);
     //}
 }
Пример #29
0
 public void DeleteProduct(int ID)
 {
     using (var context = new CBContext())
     {
         var product = context.Products.Find(ID);
         //context.Entry(category).State = System.Data.Entity.EntityState.Deleted;
         context.Products.Remove(product);
         context.SaveChanges();
     }
 }
Пример #30
0
 public List <OrderItem> GetBillNoItems(int billno)
 {
     using (var context = new CBContext())
     {
         //below line of code is added to make lazy loading =false if we didnot disable it,it show error of connection expose when passing
         //list to view through json.
         context.Configuration.LazyLoadingEnabled = false;
         return(context.OrderItems.Where(x => x.OrderID == billno).Include(x => x.Product).ToList());
     }
 }