public ActionResult ReserveHolidayHome(ReverveHolidayHomeModel model) { if (model.dateTo <= model.dateFrom) { ModelState.AddModelError("dateTo", "Date should be later than above"); } if (model.dateFrom == null) { ModelState.AddModelError("dateFrom", "Pole nie moze być puste"); } if (ModelState.IsValid) { //repository.BookHolidayHome(model.holidayhomeId, model.dateFrom, model.dateTo); CheckBookingModel modelbook = repository.bookholidayhome(model.holidayhomeId, model.dateFrom, model.dateTo); ViewBag.checkbookingmodel = modelbook; return(RedirectToAction("ShowDetailsHolidayHome", "Home", new { Id = model.holidayhomeId })); } else { HolidayHome holidayhome = repository.GetHolidayHomeById(model.holidayhomeId); List <DateTime> list = repository.GetDaysBookedHolidayHome(model.holidayhomeId); List <string> liststring = new List <string>(); foreach (var item in list) { liststring.Add(item.ToShortDateString()); } BookViewModel viewmodel = new BookViewModel(); viewmodel.holidayhome = holidayhome; viewmodel.list = liststring; //return View("~/Views/Client/Book/HolidayHome.cshtml", viewmodel); return(View("~/Views/Client/BookHolidayHome.cshtml", viewmodel)); } }