示例#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());
            }
        }
 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();
     }
 }
 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();
     }
 }
        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();
     }
 }
 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());
     }
 }