Exemplo n.º 1
0
        public OrderViewModel GetDataForOrderCreate(string userId)
        {
            var user = userRepo.GetUser(userId);

            var model = new OrderViewModel
            {
                Locations   = griddingRepo.GetLocations().Where(l => l.IsActive).ToList(),
                Estates     = griddingRepo.GetEstates().ToList(),
                Products    = orderRepo.GetFFProducts(),
                ISPProducts = ispRepo.GetProducts().Where(u => u.ISPId == user.ISPId).ToList(),
                Discounts   = ispRepo.GetEstateDiscounts(userId)
            };

            return(model);
        }
Exemplo n.º 2
0
 public List <Location> GetLocations()
 {
     return(griddingRepo.GetLocations()
            .Include(l => l.Estates)
            .Include(l => l.ISPLocationProducts).ToList()
            .Select(l => new Location
     {
         Estates = l.Estates.Where(e => !e.IsDeleted).ToList(),
         LocationId = l.LocationId,
         Name = l.Name,
         APIName = l.APIName,
         PrecinctCode = l.PrecinctCode,
         Residents = l.Residents,
         AllowOrder = l.AllowOrder,
         IsActive = l.IsActive,
         ISPLocationProducts = l.ISPLocationProducts
     }).ToList());
 }
        public List <Location> GetLocations()
        {
            List <Location> locations = HttpContext.Current.Cache["Locations"] as List <Location>;

            if (locations == null)
            {
                locations = griddingRepo.GetLocations().Where(l => l.IsActive).OrderBy(l => l.Name).ToList();
                locations.Insert(0, new Location
                {
                    LocationId = -1,
                    Name       = "Other",
                    APIName    = ""
                });

                HttpContext.Current.Cache["Locations"] = locations;
            }
            return(locations);
        }