public string GetTravelClassSeatCount(TravelClass travelClass) { string seatCount = "0"; try { var match = TrainTypeTravelClasses.Where(x => x.TravelClassId == travelClass.Id).Single(); seatCount = match == null ? "0" : match.NumberOfSeats.ToString(); return(seatCount); } catch (Exception) { return("None"); } }
public string GetPriceAndSeats(TravelClass travelClass, DateTime date) { var info = "NA"; try { var scheduleTravelClass = ScheduleTravelClasses.Where(x => x.TravelClassId == travelClass.Id).SingleOrDefault(); if (scheduleTravelClass != null) { info = string.Format("NGN {0}({1} seat(s) left)", scheduleTravelClass.Price, scheduleTravelClass.GetRemainingSeats(date)); } } catch (Exception ex) { } return(info); }