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(); } }
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(); } }
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(); } }
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()); } }
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(); } }
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); } }
public void SaveCategory(Category category) { using (var context = new CBContext()) { context.Categories.Add(category); context.SaveChanges(); } }
public void DeleteProduct(int ID) { using (var context = new CBContext()) { var product = context.Products.Find(ID); context.Products.Remove(product); context.SaveChanges(); } }
/////////////////////////////////////////////////////////////////////////////////////////////////////// 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(); } }
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(); } }
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(); } }
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(); } }
public void DeleteWishlist(int ID) { using (var context = new CBContext()) { var Wishlist = context.wishlist.Find(ID); context.wishlist.Remove(Wishlist); context.SaveChanges(); } }
public int ShopPageSize() { using (var context = new CBContext()) { // var pageSizeConfig = context.configurations.Find("ShopPageSize"); // return pageSizeConfig != null ? int.Parse(pageSizeConfig.Value) : 6; return(6); } }
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(); } }
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()); } }
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); } }
///////////////////////////////////////////////////////////////////////// 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(); } }
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(); } }
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); //} }
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(); } }
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()); } }