// ====================================== // Author: Ebenezer Monney // Email: info@ebenmonney.com // Copyright (c) 2017 www.ebenmonney.com // // ==> Gun4Hire: contact@ebenmonney.com // ====================================== using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using DAL.Models; using DAL.Repositories.Interfaces; namespace DAL.Repositories { public class CustomerRepository : Repository, ICustomerRepository { public CustomerRepository(ApplicationDbContext context) : base(context) { } public IEnumerable GetTopActiveCustomers(int count) { throw new NotImplementedException(); } public IEnumerable GetAllCustomersData() { return appContext.Customers .Include(c => c.Orders).ThenInclude(o => o.OrderDetails).ThenInclude(d => d.Product) .Include(c => c.Orders).ThenInclude(o => o.Cashier) .OrderBy(c => c.Name) .ToList(); } private ApplicationDbContext appContext { get { return (ApplicationDbContext)_context; } } } }