public IEnumerable <Purchase> All() { using (var dbContext = new SportStoreDbContext()) { return(dbContext.PurchaseDbSet.ToList()); } }
public IEnumerable <Product> Find(Predicate <Product> predicate) { using (var dbContext = new SportStoreDbContext()) { return(dbContext.ProductDbSet.Include(i => i.CustomFields.Select(ii => ii.CustomField)).AsEnumerable().Where(p => predicate.Invoke(p)).ToList()); } }
public IEnumerable <User> All() { using (var dbContext = new SportStoreDbContext()) { return(dbContext.UserDbSet.AsEnumerable().ToList()); } }
public IEnumerable <Category> Find(Predicate <Category> predicate) { using (var dbContext = new SportStoreDbContext()) { return(dbContext.CategoryDbSet.Include(i => i.CustomFields).AsEnumerable().Where(c => predicate.Invoke(c)).ToList()); } }
public Product GetById(Guid code) { using (var dbContext = new SportStoreDbContext()) { return(dbContext.ProductDbSet.Include(i => i.CustomFields.Select(ii => ii.CustomField)).SingleOrDefault(p => p.Code == code)); } }
public IEnumerable <ShippingAddress> Find(Predicate <ShippingAddress> predicate) { using (var dbContext = new SportStoreDbContext()) { return(dbContext.ShippingAddressDbSet.AsEnumerable().Where(sa => predicate.Invoke(sa)).ToList()); } }
public Category GetById(Guid id) { using (var dbContext = new SportStoreDbContext()) { return(dbContext.CategoryDbSet.Include(i => i.CustomFields).SingleOrDefault(c => c.Id == id)); } }
public IEnumerable <PaymentMethod> All() { using (var dbContext = new SportStoreDbContext()) { return(dbContext.PaymentMethodDbSet.AsEnumerable().ToList()); } }
public IEnumerable <PaymentMethod> Find(Predicate <PaymentMethod> predicate) { using (var dbContext = new SportStoreDbContext()) { return(dbContext.PaymentMethodDbSet.AsEnumerable().Where(p => predicate(p)).ToList()); } }
public Role GetById(string name) { using (var dbContext = new SportStoreDbContext()) { return(dbContext.RoleDbSet.Find(name)); } }
public PaymentMethod GetById(Guid id) { using (var dbContext = new SportStoreDbContext()) { return(dbContext.PaymentMethodDbSet.Find(id)); } }
public IEnumerable <PurchasedProduct> Find(Predicate <PurchasedProduct> predicate) { using (var dbContext = new SportStoreDbContext()) { return(dbContext.PurchasedProductDbSet.AsEnumerable().Where(p => predicate.Invoke(p))); } }
public IEnumerable <PurchasedProduct> All() { using (var dbContext = new SportStoreDbContext()) { return(dbContext.PurchasedProductDbSet.AsEnumerable()); } }
public PurchasedProduct GetById(Guid id) { using (var dbContext = new SportStoreDbContext()) { return(dbContext.PurchasedProductDbSet.Find(id)); } }
public ShippingAddress GetById(Guid id) { using (var dbContext = new SportStoreDbContext()) { return(dbContext.ShippingAddressDbSet.Find(id)); } }
public Session GetByToken(string token) { using (var dbContext = new SportStoreDbContext()) { return(dbContext.SessionDbSet.Find(token)); } }
public IEnumerable <ShippingAddress> All() { using (var dbContext = new SportStoreDbContext()) { return(dbContext.ShippingAddressDbSet.AsEnumerable().ToList()); } }
public IEnumerable <Session> Find(Predicate <Session> predicate) { using (var dbContext = new SportStoreDbContext()) { return(dbContext.SessionDbSet.AsEnumerable().Where(s => predicate(s)).ToList()); } }
public Manufacturer GetById(Guid id) { using (var dbContext = new SportStoreDbContext()) { return(dbContext.ManufacturerDbSet.Find(id)); } }
public Review GetById(Guid id) { using (var dbContext = new SportStoreDbContext()) { return(dbContext.ReviewDbSet.Include(i => i.PurchasedProduct).Include(i => i.User).SingleOrDefault(r => r.Id == id)); } }
public IEnumerable <Category> All() { using (var dbContext = new SportStoreDbContext()) { return(dbContext.CategoryDbSet.Include(i => i.CustomFields).ToList()); } }
public IEnumerable <Review> Find(Predicate <Review> predicate) { using (var dbContext = new SportStoreDbContext()) { return(dbContext.ReviewDbSet.AsEnumerable().Where(r => predicate.Invoke(r)).ToList()); } }
public void Update(Category category) { using (var dbContext = new SportStoreDbContext()) { var categoryInRepository = dbContext.CategoryDbSet.Include(i => i.CustomFields).SingleOrDefault(c => c.Id == category.Id); categoryInRepository.Name = category.Name; categoryInRepository.Description = category.Description; foreach (var categoryCustomField in category.CustomFields) { var customFieldInRepository = categoryInRepository.CustomFields.SingleOrDefault(cf => cf.Name == categoryCustomField.Name); if (customFieldInRepository != null) { customFieldInRepository.Description = categoryCustomField.Description; } else { categoryInRepository.CustomFields.Add(categoryCustomField); } } var customFieldsInRepositoryToDelete = categoryInRepository.CustomFields.FindAll(cf => !category.CustomFields.Any(ccf => ccf.Name == cf.Name)); foreach (var customFieldInRepositoryToDelete in customFieldsInRepositoryToDelete) { categoryInRepository.CustomFields.Remove(customFieldInRepositoryToDelete); } dbContext.SaveChanges(); } }
public Review GetByPurchasedProductId(Guid id) { using (var dbContext = new SportStoreDbContext()) { return(dbContext.ReviewDbSet.SingleOrDefault(r => r.PurchasedProduct.Id == id)); } }
public IEnumerable <Product> All() { using (var dbContext = new SportStoreDbContext()) { return(dbContext.ProductDbSet.Include(i => i.CustomFields.Select(ii => ii.CustomField)).ToList()); } }
public Cart GetById(Guid id) { using (var dbContext = new SportStoreDbContext()) { return(dbContext.CartDbSet.Include(i => i.Products).SingleOrDefault(c => c.Id == id)); } }
public User GetById(string userName) { using (var dbContext = new SportStoreDbContext()) { return(dbContext.UserDbSet.Find(userName)); } }
public IEnumerable <Cart> Find(Predicate <Cart> predicate) { using (var dbContext = new SportStoreDbContext()) { return(dbContext.CartDbSet.AsEnumerable().Where(c => predicate.Invoke(c)).ToList()); } }
public IEnumerable <User> Find(Predicate <User> predicate) { using (var dbContext = new SportStoreDbContext()) { return(dbContext.UserDbSet.AsEnumerable().Where(u => predicate(u)).ToList()); } }
public Purchase GetById(Guid id) { using (var dbContext = new SportStoreDbContext()) { return(dbContext.PurchaseDbSet.SingleOrDefault(p => p.Id == id)); } }