public MainWindowViewModel(AutoViewModel autoViewModel, KundeViewModel kundeViewModel, ReservationViewModel reservationViewModel) { this.autoViewModel = autoViewModel; this.kundeViewModel = kundeViewModel; this.reservationViewModel = reservationViewModel; }
public ReservationViewModel ToViewModel() { var viewModel = new ReservationViewModel() { ClientId = Client.Id, //RoomId = Ro.Nume, Id = Id, CheckIn = CheckIn, CheckOut = CheckOut, }; return(viewModel); }
public ActionResult DeleteReservation(ReservationViewModel model) { try { _savingLogic.DeleteReservation(model.ReservationId); return(RedirectToAction("Details", "Savings", new { id = model.SavingsId })); } catch (Exception e) { Console.WriteLine(e); return(RedirectToAction("Details", "Savings", new { id = model.SavingsId })); } }
public SelectList GetFlight(ReservationViewModel input) { var query = from f in db.Flights where f.FlightID == input.SelectedFlight.FlightID select f; List <Flight> flight = query.ToList <Flight>(); SelectList allCitieslist = new SelectList(flight, "FlightID", "FlightNumber"); return(allCitieslist); }
public async Task <IActionResult> Reserve(int roomId, [FromBody] ReservationViewModel model) { model.Reservation.ApplicationUserId = GetUserId(); model.Reservation.RoomId = roomId; model.Reservation.IsConfirmed = false; if (!ModelState.IsValid) { return(BadRequest(model)); } var reservation = await reservationService.AddAsync(model.Reservation); return(Ok(reservation)); }
public ActionResult ReserveACopy2(int bookId) { UserLoginViewModel userLogin = Session["UserModel"] as UserLoginViewModel; List <BookViewModel> bookList = Session["BookList"] as List <BookViewModel>; ReservationViewModel reservationVM = WebApiClient.ReserveACopy(bookId, userLogin.UserLoginId); BookViewModel book = WebApiClient.GetAllBooks().Where(x => x.BookId == bookId).SingleOrDefault(); //ViewData["resMessage"] = reserved ? "Your book has been reserved" : ""; //ViewData["reserved"] = reserved; //Session["ReservationViewModel"] = reservationVM; return(RedirectToAction("Report")); }
public IActionResult EditReservationByPatient(long id) { var res = mContext.Reservations.FirstOrDefault(a => a.Id == id); var model = new ReservationViewModel() { ID = res.Id, Objects = res.Objects, DateTime = res.DateTime }; return(View(model)); }
public ActionResult DeleteReservation(int id) { try { var model = new ReservationViewModel(_savingLogic.GetReservationById(id)); return(View("~/Views/Savings/DeleteReservationPartial.cshtml", model)); } catch (Exception e) { Console.WriteLine(e); return(RedirectToAction("Index", "Savings")); } }
// GET: Reservations/Create public ActionResult Create(int?page, string sort) { this.ViewBag.page = page ?? 1; this.ViewBag.sort = sort; var list = _contactTypeService.GetAll().Items; this.ViewBag.ContactTypeId = new SelectList(list, "Id", "Description"); var reservationDto = new ReservationViewModel(); return(View(reservationDto)); }
public void ReservationenLoadTest() { TestEnvironmentHelper.InitializeTestData(); var target = new ReservationViewModel(); var targetCommand = target.LoadCommand; Assert.IsTrue(targetCommand.CanExecute(null)); targetCommand.Execute(null); Assert.AreEqual(1, target.Reservationen.Count); }
public IActionResult Index(ReservationLocationViewModel lsvm) { if (ModelState.IsValid) { var mainReservationModel = new ReservationViewModel { InitialSetup = lsvm }; SaveObjectToSession(mainReservationModel, "reservationwizard"); return(RedirectToAction("ReservationVehicleSetup")); } return(View(lsvm)); }
public ActionResult Add(ReservationViewModel model) { var user = User.Identity; var dbUser = this.userService.GetByUserName(user.Name); model.UserId = dbUser.Id; var reservation = model.CreateReservation(); this.reservationService.Add(reservation); return(RedirectToAction("Index", "Hotels")); }
// GET: Reservation public ActionResult Index() { var currentUser = authenticationUserManager.Users.First(x => x.Id == User.Identity.GetUserId()); var userReservations = hireEquipmentService.GetHires().Where(x => x.User.Id == currentUser.Id); //var equipments = hireEquipmentService.GetEquipments var model = new ReservationViewModel() { Equipment = Mapper.Map <List <EquipmentViewModel> >(userReservations) }; return(View(model)); }
public async Task <ActionResult> MakeReservation() { ReservationViewModel reservation = new ReservationViewModel { RoomTypes = await _roomRepo.GetAllRoomTypes(), Rooms = await _roomRepo.GetAllRooms(), }; ViewBag.NumberOfGuests = GetListOfAllowedGuests(); ViewBag.NumberOfRooms = GetListOfAllowedRooms(); return(View(reservation)); }
public ActionResult New(string hall) { var model = new ReservationViewModel { HallNames = this.GetHalls() }; if (!string.IsNullOrEmpty(hall) && this.hallsRepository.AllBy(x => x.Name == hall).Any()) { model.HallName = hall; } return(this.View(model)); }
public IActionResult Reservation() { var FlightId = HttpContext.Session.GetString("FlightId"); var sesijaUser = HttpContext.Session.GetString("Test"); var korisnik = _repoWrapper.User.getUsers.Where(u => u.Email == sesijaUser); ReservationViewModel reservationView = new ReservationViewModel() { Name = korisnik.Select(n => n.Name).FirstOrDefault(), Surname = korisnik.Select(s => s.Surname).FirstOrDefault() }; return(View(reservationView)); }
public async Task <ActionResult> Edit(int?id, int?bikeid, int?homeStoreID) { var storesSelect = await(from s in _context.Stores select s.AddressLine1).ToListAsync(); var reservationVM = new ReservationViewModel(); reservationVM.BikeStores = new SelectList(storesSelect); bool exists; //if the reservation doesnt exist, create a new reservation and pull the bike and homestore id from the URL, and set the start datetime to now. if (id == 0) { exists = false; reservationVM.Reservation = new Reservation(); if (bikeid != null) { reservationVM.Reservation.BikeID = (int)bikeid; } if (homeStoreID != null) { reservationVM.Reservation.HomeStoreID = (int)homeStoreID; } reservationVM.Reservation.StartDate = System.DateTime.Now; reservationVM.HomeStore = await(from s in _context.Stores where s.StoreID == homeStoreID select s.AddressLine1).FirstOrDefaultAsync(); } //if the resrvation does exist, pull the existing information else { exists = true; reservationVM.Reservation = await repository.GetReservation(id); reservationVM.HomeStore = await(from s in _context.Stores where s.StoreID == reservationVM.Reservation.HomeStoreID select s.AddressLine1).FirstOrDefaultAsync(); reservationVM.DropOffStore = await(from s in _context.Stores where s.StoreID == reservationVM.Reservation.RentedStoreID select s.AddressLine1).FirstOrDefaultAsync(); } reservationVM.HomeStore = await(from s in _context.Stores where s.StoreID == reservationVM.Reservation.HomeStoreID select s.AddressLine1).FirstOrDefaultAsync(); reservationVM.DropOffStore = await(from s in _context.Stores where s.StoreID == reservationVM.Reservation.RentedStoreID select s.AddressLine1).FirstOrDefaultAsync(); return(View(reservationVM)); }
public IActionResult LoadReservations(int roomId) { base.CheckForLogin(); HttpContext.Session.SetInt32("roomID", roomId); Room room = new Room(Convert.ToInt32(HttpContext.Session.GetInt32("roomID")), "test"); ReservationRepository repo = new ReservationRepository(new ReservationSQLContext()); List <Reservation> reservations = repo.GetReservations(room); ReservationViewModel viewmodel = new ReservationViewModel(); viewmodel.Reservations = (reservations); viewmodel.AddRoomId(roomId); return(View("ReserveRoom", viewmodel)); }
public ActionResult CompleteReservation(Dictionary<string, string> roomsToBook) { if (roomsToBook.All(r => r.Value == "0" || string.IsNullOrEmpty(r.Value))) { this.TempData["Notification"] = "No room selected.Choose new dates"; return this.RedirectToAction("Index", "Home"); } var dates = this.Session["SearchDates"] as SearchInputModel; var newRoomsToBook = new Dictionary<string, int>(); var roomToBookTypes = new List<string>(); foreach (var roomType in roomsToBook) { if (roomType.Value != "0" && !string.IsNullOrEmpty(roomType.Value)) { newRoomsToBook.Add(roomType.Key, int.Parse(roomType.Value)); roomToBookTypes.Add(roomType.Key); } } var reservation = new ReservationViewModel { CreatorId = this.User.Identity.GetUserId(), StartDate = dates.Start, EndDate = dates.End, Rooms = new List<BookedRoomView>() }; var availableRoomsTypes = this.rooms .AvailableForPeriod(dates.Start, dates.End).ToList() .Where(r => roomToBookTypes.Contains(r.RoomType.Type)) .GroupBy(r => r.RoomType.Type); foreach (var roomType in availableRoomsTypes) { roomType .Take(newRoomsToBook[roomType.Key]) .ForEach(x => reservation.Rooms.Add(new BookedRoomView { Guests = new List<PersonInputModel>(), Room = x, Status = ReservationStatus.Pending })); } this.Session["reservation"] = reservation; return new HttpStatusCodeResult(HttpStatusCode.OK); }
public ActionResult AddReservation(ReservationViewModel model) { try { _savingLogic.AddReservation(model); _savingLogic.RefreshSavingsAmount(model.SavingsId); return(RedirectToAction("Index", "Account")); } catch (Exception e) { Console.WriteLine(e); return(RedirectToAction("Index", "Account")); } }
public IActionResult Edit(int?id) { if (id == null || id <= 0) { return(NotFound()); } ReservationViewModel reservationVM = _reservationIndexViewModels.Items.FirstOrDefault(x => x.Id == id); if (reservationVM == null) { return(NotFound()); } return(View("Edit", reservationVM)); }
private static IList <int> CalculateWeekdaysToRepeat(ReservationViewModel model) { var weekDaysToRepeat = new List <int>(); for (int i = 0; i < model.RepetitionPolicy.RepetitionDays.Count; i++) { if (model.RepetitionPolicy.RepetitionDays[i]) { weekDaysToRepeat.Add(i); } } return(weekDaysToRepeat); }
private static int CalculateDaysToSkip(ReservationViewModel model) { var daysToSkip = 7; if (model.RepetitionPolicy.RepetitionWindow.HasValue) { // we need to add 1 .. otherwise we'd end up with less reservations - // the week of the initial reservation does not count! var weeksWindow = model.RepetitionPolicy.RepetitionWindow.Value + 1; daysToSkip = daysToSkip * weeksWindow; } return(daysToSkip); }
public ActionResult Index() { var all = _reservationlogic.GetAll(); var reservationViews = new List<ReservationViewModel>(); foreach (var item in all) { if (User.HasClaim(ClaimTypes.Email, item.Email)) { reservationViews.Add(ReservationViewModel.ConvertModelToReservationViewModel(item)); } } return View(reservationViews); }
// GET: ReservationFlightDetails/Create //public ActionResult Create(ReservationViewModel FlightInfo) public ActionResult Create(ReservationViewModel FlightInfo) //int ReservationNumber, bool RoundTrip, bool AnotherFlight, int NumberOfFliers, int FlightID { ReservationFlightDetail flightdetail = new ReservationFlightDetail(); ViewBag.ReservationNumber = FlightInfo.ReservationNumber; ViewBag.Fare = GetBaseFare(FlightInfo.FlightID); ViewBag.SelectedFlight = GetFlight(FlightInfo.FlightID); ViewBag.AllUsers = GetAllUsers(); ViewBag.AvailableSeats = GetAvailableSeats(FlightInfo.FlightID); flightdetail.Flight = db.Flights.First(f => f.FlightID == FlightInfo.FlightID); flightdetail.Reservation = db.Reservations.First(r => r.ReservationNumber == FlightInfo.ReservationNumber); return(View()); }
private static string FormatNewReservationEmail(ReservationViewModel model, string token) { var date = FormatDate(model.Date); return(string.Format( NewReservationTemplate, model.Organizer.Name, model.Title, date, model.StartHour, model.EndHour, token )); }
public async Task <IActionResult> Reservations() { var userId = await this.usersService.GetUserIdAsync(this.User); var reservations = await this.roomsService .GetAllReservationsAsync <ReservationsAllViewModel>(userId); var reservationView = new ReservationViewModel() { AllReservations = reservations, }; return(this.View(reservationView)); }
public void ReservationenLoadTest() { ReservationViewModel vm = new ReservationViewModel(kernel.Get <IServiceFactory>()); vm.Init(); ICommand targetCommand = vm.LoadCommand; Assert.IsTrue(targetCommand.CanExecute(null)); targetCommand.Execute(null); Assert.AreEqual(3, vm.Reservationen.Count); }
public ActionResult Reservate(int id) { var RoomDb = context.Rooms.SingleOrDefault(r => r.Id == id); var model = new ReservationViewModel() { Room = RoomDb, RoomId = id, StartTime = Reservation.setStartTime(), EndTime = Reservation.setEndTime(), }; return(View(model)); }
public IActionResult SignUpPage(int tourId) { if (ModelState.IsValid) { ReservationViewModel res = new ReservationViewModel { tour = _repository.Tours.Where(t => t.TourId == tourId).SingleOrDefault() }; return(View("AddInfo", res)); } return(View()); }
public ReservationViewModel ToReservationViewModel(Reservation reservation) { var reservationClient = new ReservationViewModel { ReservationId = reservation.Id.ToString(), //Destination = reservation.Destination, //PartnerName = reservation.PartnerName.CompanyName, //Date = reservation.Date, Status = reservation.Status, //Name = reservation.CreatedBy.Name }; return(reservationClient); }
public JsonResult GetFreeRoom(ReservationViewModel reservation) { try { UserService service = new UserService(); var rooms = service.GetFreeRoom(reservation); return(Json(rooms)); } catch (Exception ex) { throw; } }