public HomeController(IHolidaysRepository repoparam, Func <string> GetUserId, FiltrResortHotel filtr, IFiltrFactory filtrfactory, FiltrRoomHolidayHome filtrroomholidayhome) { repository = repoparam; this.GetUserId = GetUserId; this.filtr = filtr; this.filtrfactory = filtrfactory; this.filtrroomholidayhome = filtrroomholidayhome; }
public HomeController(IHolidaysRepository repoparam, Func <string> GetUserId, FiltrResortHotel filtr) { repository = repoparam; this.GetUserId = GetUserId; this.filtr = filtr; filtrfactory = new FiltrFactory(repository); filtrroomholidayhome = new FiltrClassHolidayHome(repository); }
public HomeController(IHolidaysRepository repoparam) { repository = repoparam; GetUserId = () => User.Identity.GetUserId(); filtr = new FiltrClassResortHotel(repository); filtrfactory = new FiltrFactory(repository); filtrroomholidayhome = new FiltrClassHolidayHome(repository); }
public ActionResult FiltrRoomAndHolidayHomeSecond(string country, string city, Choose choose, int guestnumber = 0, int bednumber = 0, DateTime?bookfrom = null, DateTime?bookto = null, List <HolidayHome> holidayhomes = null, List <Room> rooms = null) { List <Room> r = rooms; if (string.IsNullOrEmpty(country)) { ModelState.AddModelError("country", "Country is Required"); } if (string.IsNullOrEmpty(city)) { ModelState.AddModelError("city", "City is Required"); } if (bookfrom > bookto) { ModelState.AddModelError("bookfrom", "Book From is Later than Book To"); } if (bookfrom == bookto && bookto != null) { ModelState.AddModelError("bookfrom", "Book From is equal Book To"); } if (bookfrom <= DateTime.Now) { ModelState.AddModelError("bookfrom", "Book From should be later than today"); } if (bookto <= DateTime.Now) { ModelState.AddModelError("bookto", "Book to should be later than today"); } if (!ModelState.IsValid) { SearchModelView viewModel = new SearchModelView(); if (holidayhomes == null) { holidayhomes = new List <HolidayHome>(); } if (rooms == null) { rooms = new List <Room>(); } viewModel.holidayhomes = holidayhomes; viewModel.rooms = rooms; return(View("FiltrRoomAndHolidayHome", viewModel)); } IFiltrFactory factory = filtrfactory; FiltrRoomHolidayHome filtrclass = factory.CreateObject(choose); filtrclass.Country = country; filtrclass.City = city; filtrclass.GuestNumber = guestnumber; filtrclass.BedNumber = bednumber; filtrclass.BookFrom = bookfrom == null ? DateTime.MinValue : (DateTime)bookfrom; filtrclass.BookTo = bookto == null ? DateTime.MinValue : (DateTime)bookto; filtrclass.Filtr(); SearchModelView viewmodel = new SearchModelView(); viewmodel.holidayhomes = filtrclass.HolidayHomes; viewmodel.rooms = filtrclass.Rooms; return(View("FiltrRoomAndHolidayHome", viewmodel)); }