private void LoadDataForDeatiledServicesSelect() { if (Booths == null) { Booths = AvailableRentalItems.Where(a => a.Type == RentalItemType.PhotoBooth).ToList(); //SelectedBooth = Booths.FirstOrDefault(); } if (Backgrounds == null) { Backgrounds = AvailableRentalItems.Where(a => a.Type == RentalItemType.Background).ToList(); //SelectedBackground = Backgrounds.FirstOrDefault(); } if (Props == null) { Props = AvailableRentalItems.Where(a => a.Type == RentalItemType.Prop).ToList(); } if (SelectedRentalItemTypes.Contains(RentalItemType.PhotoBooth)) { BoothSelect = true; } if (SelectedRentalItemTypes.Contains(RentalItemType.Background)) { BackgroundSelect = true; } if (SelectedRentalItemTypes.Contains(RentalItemType.Prop)) { PropsSelect = true; } }
public async Task <ICollection <RentalItemModel> > GetAvailableRentalItemsAsync(DateTime since, DateTime till, RentalItemType?type = null) { using (UnitOfWorkFactory.Create()) { var query = new AvailableRentalItems(UnitOfWorkFactory, since, till, type); return(await query.ExecuteAsync()); } }
private void LoadDataForServiceSelect() { //calling DB AvailableRentalItems = _catalogFacade.GetAvailableRentalItemsAsync(OrderBasicInfo.Since, OrderBasicInfo.Since.AddHours(OrderBasicInfo.CountOfHours)).Result; Packages = _catalogFacade.GetAllPackagesAsync().Result; Products = _catalogFacade.GetAvailableProductsAsync().Result; AvailableRentalTypes = AvailableRentalItems.Select(a => a.Type).Distinct().Where(a => a != RentalItemType.Employe).ToList(); //when we do "default selection" it does not bind correctly //SelectedPackage = Packages.FirstOrDefault(); UpdateItemsBasedOnSelectedPackage(); }
public bool AreAllRentalItemsAvailable(ICollection <RentalItemModel> items, DateTime since, DateTime till) { var availables = new AvailableRentalItems(base.UnitOfWorkFactory, since, till).Execute(); return(items.All(x => availables.Contains(x))); }