public IActionResult SearchBus(BusSearchViewModel model) { if (ModelState.IsValid) { var busFound = this._busRepo.GetBusesByCity(model.SelectedSourceCity, model.SelectedDestinationCity); var busFoundModel = new BusFoundViewModel(); busFoundModel.busFound = busFound; busFoundModel.dateToTravel = model.DateToTravel; busFoundModel.SourceCity = model.SelectedSourceCity; busFoundModel.DestinationCity = model.SelectedDestinationCity; /*if(busFoundModel.SourceCity.Equals(busFoundModel.DestinationCity) * { * ErrorMessage = "Source City and Destination city cannot be same"; * } * else * {*/ return(View("BusFound", busFoundModel)); //} } else { return(View(model)); } }
public IActionResult BusFound(string Scity, string Dcity) { BusFoundViewModel busFound = new BusFoundViewModel(); busFound.SourceCity = Scity; busFound.DestinationCity = Dcity; return(View(busFound)); }