private int GetSportCentreId(string sportCentre) { return(SportCentre.Where((SportCentre sportCentr) => sportCentr.Name.Equals(sportCentre)).First().SportCentreID); }
public List <Reservation> MyReservations() { string sportCentre = UserController.selectedSportCentre_MyReservations; string sport = UserController.selectedSport_myReservations; if (sportCentre != null && sportCentre.Equals("All sport centres")) { sportCentre = null; } if (sport != null && sport.Equals("All sports")) { sport = null; } List <Reservation> reservations = Reservations(LoginController.currentyLoggedPerson); if (sportCentre == null && sport == null) { return(reservations); } if (sportCentre == null && sport != null) { for (int i = 0; i < reservations.Count; i++) { Hall h = Hall.Where((Hall hall) => hall.HallID.Equals(reservations[i].HallID)).First(); if (!h.Sport.ToString().Equals(sport)) { reservations.Remove(reservations[i]); i--; } } } if (sportCentre != null && sport == null) { SportCentre SC = SportCentre.Where((SportCentre SportCentre) => SportCentre.Name.Equals(sportCentre)).First(); for (int i = 0; i < reservations.Count; i++) { Hall h = Hall.Where((Hall hall) => hall.HallID.Equals(reservations[i].HallID)).First(); if (!h.SportCentreID.Equals(SC.SportCentreID)) { reservations.Remove(reservations[i]); i--; } } } else if (sportCentre != null && sport != null) { SportCentre sc = SportCentre.Where((SportCentre SportCentre) => SportCentre.Name.Equals(sportCentre)).First(); for (int i = 0; i < reservations.Count; i++) { Hall h = Hall.Where((Hall hall) => hall.HallID.Equals(reservations[i].HallID)).First(); if (!h.SportCentreID.Equals(sc.SportCentreID) || !h.Sport.ToString().Equals(sport)) { reservations.Remove(reservations[i]); i--; } } } UserController.selectedSportCentre_MyReservations = null; UserController.selectedSport_myReservations = null; return(reservations); }
public SportCentre GetSportCentreByID(int sportCentreID) { return(SportCentre.Where((SportCentre sportCentre) => sportCentreID == sportCentre.SportCentreID).First()); }
public SportCentre FindSportCentre(string etName, string etAddress) { return(SportCentre.Where((SportCentre sc) => sc.Name.Equals(etName) && sc.Address.Equals(etAddress)).First()); }
public SportCentre GetSportCentre(int hallID) { return(SportCentre.Where((SportCentre sportCentre) => GetHall(hallID).SportCentreID.Equals(sportCentre.SportCentreID)).First()); }