/// <summary> /// Action To Show The Search Result /// By Given City ID /// </summary> /// <param name="info"></param> /// <param name="CityId"></param> /// <returns></returns> public ActionResult SearchResult(SearchInfo info, int CityId = 0) { try { if (CityId != 0) { CreateSession(); DateTime ciDate = (DateTime)info.CheckInDate; DateTime coDate = (DateTime)info.CheckOutDate; if (coDate >= ciDate) { TimeSpan span = coDate - ciDate; info.NoOfNight = span.Days + 1; searchManager.SaveSearchInfo(info); if (hotelManager.Search(CityId).Count > 0) { return(View(hotelManager.Search(CityId))); } else { TempData["DateerrorMessage"] = "No Hotel Found On Particular City"; } } else { TempData["DateerrorMessage"] = "Check Out Date Should Be <= To Check In Date"; } } else { TempData["DateerrorMessage"] = "Please Select all field"; return(RedirectToAction("Index", "HotelBooking")); } } catch (Exception ex) { Console.WriteLine(ex.Message); } return(RedirectToAction("Index", "HotelBooking")); }