public CustomerRepository(BicycleRentalDbContext context)
        {
            _context = context;

            _customerStatus = new List <SelectListItem>()
            {
                new SelectListItem {
                    Value = "Active", Text = "Active"
                },
                new SelectListItem {
                    Value = "InActive", Text = "InActive"
                }
            };
        }
        public BookingRepository(BicycleRentalDbContext context)
        {
            _context = context;

            _bikes = _context.BicycleInventories.AsNoTracking()
                     .Where(x => x.Status == "Available")
                     .Select(x => new SelectListItem
            {
                Value = x.BikeId.ToString(),
                Text  = x.ModelNo
            }).ToList();

            _customers = _context.Customers.AsNoTracking()
                         .Where(x => x.Status == "Active")
                         .Select(x => new SelectListItem
            {
                Value = x.CustomerId.ToString(),
                Text  = string.Format("{0}, {1}", x.LastName, x.FirstName)
            }).ToList();
        }
예제 #3
0
        public BikeRepository(BicycleRentalDbContext context)
        {
            _context = context;

            _statuses = new List <SelectListItem>()
            {
                new SelectListItem {
                    Value = "Available", Text = "Available"
                },
                new SelectListItem {
                    Value = "UnderMaintenance", Text = "UnderMaintenance"
                },
                new SelectListItem {
                    Value = "OutOfOrder", Text = "OutOfOrder"
                }
            };

            _bikeTypes = _context.BicycleTypes.AsNoTracking()
                         .Select(x => new SelectListItem
            {
                Value = x.BikeTypeId.ToString(),
                Text  = x.Type
            }).ToList();
        }