public Repository(GrowOnlineDevEntities _context) { this.context = _context; this.entitySet = context.Set <T>(); this.context.Configuration.ProxyCreationEnabled = true; this.context.Configuration.LazyLoadingEnabled = true; }
public ProductMasterViewModel GetAllProduct(int currentPage, string CategoryName) { try { int maxRows = 10; using (GrowOnlineDevEntities entities = new GrowOnlineDevEntities()) { ProductMasterViewModel customerModel = new ProductMasterViewModel(); customerModel.Customers = (from customer in entities.Shop_Product_Master where customer.crp_catagory == CategoryName && customer.Status == "Active" select customer) .OrderBy(customer => customer.pkSkuId) .Skip((currentPage - 1) * maxRows) .Take(maxRows).ToList(); double pageCount = (double)((decimal)entities.Shop_Product_Master.Count() / Convert.ToDecimal(maxRows)); customerModel.PageCount = (int)Math.Ceiling(pageCount); customerModel.CurrentPageIndex = currentPage; return(customerModel); } } catch (Exception ex) { throw ex; } }
/// <summary> /// Dispose Context /// </summary> public void Dispose() { if (context != null) { context.Dispose(); context = null; } }
public double CheckMinProductPrice() { GrowOnlineDevEntities objGrowOnlineDevEntities = new GrowOnlineDevEntities(); var minPrice = objGrowOnlineDevEntities.Shop_Product_Master.Min(x => x.IntPrice); var minPriceDouble = Convert.ToDouble(minPrice); return(minPriceDouble); }
public UnitOfWork(GrowOnlineDevEntities dbContext) { this.context = dbContext; }