public IActionResult Add()
        {
            var bookingViewModel = new BookingViewModel
            {
                AmountOfPlaces = 0,
                Room           = Room.Any
            };

            return(View(bookingViewModel));
        }
        public JsonResult CancelBookingPopUP(long bookingId)
        {
            BookingViewModel bookingViewModel = new BookingViewModel()
            {
                BookingId = bookingId
            };
            string convertedData = Common.HtmlHelper.RenderViewToString(this.ControllerContext, "~/Views/BookingDetail/_CancelBookingPopUp.cshtml", bookingViewModel);

            return(Json(new { code = 0, message = convertedData }));
        }
Пример #3
0
        public BookingViewModel Cancel(BookingViewModel bookingViewModel)
        {
            var booking = Mapper.Map <Booking>(bookingViewModel);

            booking.Status = 2;

            _bookingRepository.Update(booking);

            return(bookingViewModel = Mapper.Map <BookingViewModel>(booking));
        }
Пример #4
0
        public IActionResult RegistrationBooking()
        {
            BookingViewModel bookingView = _mapper.Map <BookingViewModel>(_admin.GetBooking(Convert.ToInt32(Request.Cookies[cookieClient]), Convert.ToInt32(Request.Cookies[cookieIdRoom])));

            bookingView.handling.InCheck  = Convert.ToDateTime(Request.Cookies[cookieDateLeft]);
            bookingView.handling.OutCheck = Convert.ToDateTime(Request.Cookies[cookieDateRight]);


            return(View("CreateHandling/RegistrationBooking", bookingView));
        }
        public IHttpActionResult UpdateBookingStatus(BookingViewModel booking)
        {
            bool updated = _bookingManager.UpdateBookingStatus(booking.bookingid, booking.bookingstatus);

            if (updated == false)
            {
                return(NotFound());
            }
            return(Ok(updated));
        }
Пример #6
0
        // GET: Booking/Create
        public async Task <ActionResult> Create()
        {
            Model = new BookingViewModel()
            {
                Booking = new Booking(),
                Types   = await _context.RoomTypes.ToListAsync()
            };

            return(View(Model));
        }
        // GET: Booking/Delete/5
        public ActionResult Delete(int id)
        {
            BookingViewModel booking = _bookingManager.GetBooking(id);

            if (booking == null)
            {
                return(HttpNotFound());
            }
            return(View(booking));
        }
Пример #8
0
        public void CalcTotalNightsTestFail()
        {
            var      model     = new BookingViewModel();
            DateTime startDate = DateTime.Now;
            DateTime endDate   = DateTime.Now.AddDays(7);

            int result = model.CalcTotalNights(startDate, endDate);

            Assert.AreNotEqual(17, result);
        }
Пример #9
0
        public ActionResult Calendar()
        {
            var booking = new BookingViewModel()
            {
                Package = new SelectList(facade.GetPackageGateway().ReadAll(), "Id", "Name"),
                Extras  = new MultiSelectList(facade.GetExtraGateway().ReadAll(), "Id", "Name")
            };

            return(View(booking));
        }
Пример #10
0
        public ActionResult ConfirmBooking(BookingViewModel bookVM)
        {
            bookVM.Booking = dbBooking.GetBookings().Where(x => x.Id.Equals(bookVM.Booking.Id)).FirstOrDefault();

            DateTime date = DateTime.Now;

            dbBooking.addConfirmToOrder(date, bookVM.Booking.Id);

            return(RedirectToAction("Index", "Home"));
        }
 public ActionResult NewBooking(BookingViewModel viewModel)
 {
     // Check for null viewModel
     if (!ModelState.IsValid)
     {
         viewModel.Attractions = attractionRepository.GetAll();
         return(View(viewModel));
     }
     // Do whatever else you need to do here
 }
Пример #12
0
        public async Task <ActionResult> Detail(string MessageId, string ControllerName)
        {
            BookingViewModel model = new BookingViewModel();

            model = await _bookingService.GetBookingDetail(MessageId);

            ViewBag.ControllerName = ControllerName;

            return(View(model));
        }
Пример #13
0
        //GET - CREATE
        public IActionResult Create()
        {
            BookingViewModel bookingVM = new BookingViewModel();

            bookingVM.Car = FillCarListOfSelectListItems();

            bookingVM.Customer = FillCustomerListOfSelectListItems();

            return(View(bookingVM));
        }
Пример #14
0
 public decimal tallySum(BookingViewModel bookingViewModel)
 {
     List<ExpensesViewModel> bookingExpenses = bookingViewModel.Expense.ToList();
     decimal sum = 0;
     foreach (var expense in bookingExpenses)
     {
         sum += expense.ExpenseTypeAmmount;
     }
     return sum;
 }
Пример #15
0
        public ActionResult Index(BookingViewModel bViewModel)
        {
            HttpCookie cookie = System.Web.HttpContext.Current.Request.Cookies["Bookings"];
            // bViewModel.Customers=_bRepo.GetCusti
            var Info = cookie.Value;

            bViewModel.cookiesdata = cookie.Value;
            //HttpContext.Request.Cookies.Clear();
            return(View("Index", bViewModel));
        }
        public IHttpActionResult UpdateBookingDate(BookingViewModel booking)
        {
            bool status = _bookingManager.UpdateBookingDate(booking.roomid, booking.bookingdate);

            if (status == false)
            {
                return(NotFound());
            }
            return(Ok(status));
        }
Пример #17
0
        public IActionResult Calendar(int id)
        {
            BookingViewModel bookingViewModel = new BookingViewModel();

            bookingViewModel.Bookings = bookingService.GetRoomBookings(id);

            Booking booking = new Booking();

            return(View(bookingViewModel));
        }
Пример #18
0
        public ActionResult GetBookingPartialView(int?bookingID, string viewName)
        {
            var model = new BookingViewModel();

            if (bookingID.HasValue)
            {
                model.Booking = bookingService.GetBooking(bookingID.Value);
            }
            return(PartialView(viewName, model));
        }
Пример #19
0
        // GET: Booking
        public ActionResult Index()
        {
            Booking          booking   = Booking.GetBooking();
            BookingViewModel viewModel = new BookingViewModel
            {
                BookingLines = booking.GetBookingLines(),
            };

            return(View(viewModel));
        }
Пример #20
0
        public async Task CreateSuccessfulSimpleBookingWithNoAvailablePilot()
        {
            var input = new BookingViewModel
            {
                Date            = new DateTime(2016, 11, 13),
                Name            = "My Name",
                IntlPhoneNumber = "+4711111111",
                PhoneNumber     = "11111111",
                Email           = "*****@*****.**",
                Comment         = "Blah",
            };

            var ctrl   = GetService <BookingController>();
            var result = await ctrl.Index(input);

            //Assert booking is created
            Assert.IsType <RedirectToActionResult>(result);
            Assert.Equal(1, Context.Bookings.Count());

            var booking = Context.Bookings
                          .Include(b => b.AssignedPilot)
                          .Include(b => b.AdditionalBookings)
                          .Include(b => b.BookedPilots)
                          .Include(b => b.BookingEvents)
                          .First();

            Assert.Equal(null, booking.AssignedPilot); // no pilots available
            Assert.Equal("*****@*****.**", booking.PassengerEmail);
            Assert.Equal("4711111111", booking.PassengerPhone);
            Assert.Equal("Blah", booking.Comment);

            //Assert sms is sent
            var nexmoService = (MockNexmoService)GetService <INexmoService>();

            //we should have sent two text messages: one to passenger, one to booking coordinator
            Assert.Equal(2, nexmoService.Messages.Count);

            var passengerMessage = nexmoService.Messages.Single(m => m.Recipient == "4711111111");

            Assert.Contains("We will try to find a pilot", passengerMessage.Body);

            var coordinatorMessage = nexmoService.Messages.Single(m => m.Recipient == "4798463072");

            Assert.Contains("Please find a pilot", coordinatorMessage.Body);

            //assert mail is sent
            var mailService = (MockMailService)GetService <IMailService>();

            //we should have one mail sent: to the passenger
            Assert.Equal(1, mailService.Messages.Count);

            var passengerMail = mailService.Messages.Single(m => m.Recipient == "*****@*****.**");

            Assert.Contains("Thank you", passengerMail.Body);
        }
Пример #21
0
        internal static void ValidateModel(Controller controller, BookingViewModel model, int?offerid, out IEnumerable <RestaurantMenuItem> restaurantMenuItems,
                                           out IEnumerable <RestaurantTable> restaurantTables, out SeasonalOffer restaurantOffer)
        {
            if (model.BookedFor.ToUniversalTime() < DateTime.UtcNow.Floor((long)AppConfigHelper.BookingSlotMinutes, DateTimeHelper.DateTimePrecisionLevel.Minutes))
            {
                controller.ModelState.AddModelError("addstatus", "The date and time for booking should always be a future date and time");
            }
            if (model.BookedSlots < 1)
            {
                controller.ModelState.AddModelError("addstatus",
                                                    "You need to make booking for atleast " + AppConfigHelper.BookingSlotMinutes +
                                                    " Minutes");
            }
            if (model.BookedTables.IsNullOrEmpty() || model.BookedTables.Trim(',', ' ').Split(',').All(t => !t.IsNumeric()))
            {
                controller.ModelState.AddModelError("addstatus", "Invalid or no tables selected, please try again");
            }
            if (!model.PrefferedMenuItems.IsNullOrEmpty() &&
                model.BookedTables.Trim(',', ' ').Split(',').All(t => !t.IsNumeric()))
            {
                controller.ModelState.AddModelError("addstatus", "Invalid Menu Items selected, please try again");
            }
            restaurantOffer = offerid != null
                                  ? new OfferBaseRepository().Find(offerid.Value) as SeasonalOffer
                                  : null;
            var modelTables = model.BookedTables.Trim(',', ' ').Split(',').Select(Int32.Parse);

            restaurantTables =
                new RestaurantTableRepository().SelectAll().Where(table => modelTables.Any(t => t == table.TableId));
            var modelMenuItems = model.PrefferedMenuItems.IsNullOrEmpty() ? new List <int>() : model.PrefferedMenuItems.Trim(',', ' ').Split(',').Select(Int32.Parse);

            restaurantMenuItems =
                new RestaurantMenuItemRepository().SelectAll().Where(item => modelMenuItems.Any(m => m == item.ItemId));
            if (restaurantOffer != null && restaurantOffer.Type == OfferBase.OfferType.FreeServing)
            {
                var freeitem = new RestaurantMenuItemRepository().Find(restaurantOffer.Value);
                if (freeitem != null)
                {
                    var newitemlist = new List <RestaurantMenuItem> {
                        freeitem
                    };
                    newitemlist.AddRange(restaurantMenuItems);
                    restaurantMenuItems = newitemlist;
                }
            }

            if (restaurantTables.Count() < 1)
            {
                controller.ModelState.AddModelError("addstatus", "Selected Tables does not exist, please try again");
            }
            if (modelMenuItems.Count() > 0 && restaurantMenuItems.Count() < 1)
            {
                controller.ModelState.AddModelError("addstatus", "Selected Menu Items does not exist, please try again");
            }
        }
Пример #22
0
        public IActionResult Index(int?id, int?otelId)
        {
            var bookingViewModel = new BookingViewModel()
            {
                Bookings = _bookingService.GetBookingsByOtel(otelId)
            };

            TempData["bookingId"]          = otelId;
            bookingViewModel.YearToDisplay = (id == null) ? DateTime.Today.Year : id.Value;
            return(View(bookingViewModel));
        }
Пример #23
0
        public object Get(int id)
        {
            BookingViewModel model = _bookingService.Get(id);

            if (model == null)
            {
                return(new ResponseDetails(false, $"Booking details with Id : { id } Not found."));
            }

            return(new ResponseDetails(true, model));
        }
Пример #24
0
        public object Add(BookingViewModel model)
        {
            model = _bookingService.Add(model);

            if (model == null)
            {
                return(new ResponseDetails(false, "Could not add entry in bookings."));
            }

            return(new ResponseDetails(true, model));
        }
        public IActionResult Index()
        {
            var model = new BookingViewModel()
            {
                CheckInDate  = DateTime.Now,
                CheckOutDate = DateTime.Now.AddDays(1),
                Rooms        = roomService.GetAllRooms()
            };

            return(View(model));
        }
Пример #26
0
        public ActionResult Booking()
        {
            //            var NutritionistName = _context.Users.ToList();
            var NutritionistName = _context.Users.Where(x => x.Roles.Select(y => y.RoleId).Contains("2")).ToList();
            BookingViewModel bookingViewModel = new BookingViewModel
            {
                ApplicationUser = NutritionistName
            };

            return(View(bookingViewModel));
        }
Пример #27
0
        public ActionResult CheckAvailability(BookingViewModel model)
        {
            //get accomodationPackageID
            var accomodationPackageID = model.AccomodationPackageID.Value;
            //us k against accomodations lena jin ki booking dates formulae pe ho
            //var accomodations = _serviceAccomodation.GetAllAccomodations().Where(x => x.AccomodationPackageID == accomodationPackageID && !x.Bookings.Any(r => r.ToDate >= model.FromDate && r.FromDate <= model.ToDate)).ToList();
            //accomodations ko list mein save krna krwana..
            var viewModel = new BookingCreateModel();

            return(PartialView("_Detail", viewModel));
        }
Пример #28
0
        public bool BookRoom(BookingViewModel bookingViewModel)
        {
            var config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <BookingViewModel, HM_Booking>();
            });
            IMapper mapper  = config.CreateMapper();
            var     booking = mapper.Map <BookingViewModel, HM_Booking>(bookingViewModel);

            return(_bookingRepository.BookRoom(booking));
        }
Пример #29
0
        // GET: Booking
        public ActionResult Index(string status)
        {
            var model = new BookingViewModel()
            {
                Bookings = new List <BookingDto>(),
                Status   = status
            };

            model.Bookings = _manager.GetAll();
            return(View(model));
        }
        /**
         * The method updates a order on the booking.
         */
        private void EditOrderViewModel(BookingViewModel bookingViewModel, OrderViewModel orderViewModel)
        {
            var order = bookingViewModel.OrdersListViewModel.Find(x => x.ExternalId.Equals(orderViewModel.ExternalId));


            order.Comment       = orderViewModel.Comment;
            order.OrderNumber   = orderViewModel.OrderNumber;
            order.TotalPallets  = orderViewModel.TotalPallets;
            order.BottomPallets = orderViewModel.BottomPallets;
            order.InOut         = orderViewModel.InOut;
        }
Пример #31
0
        public static KeyValuePair<Booking, BookingViewModel> RecursiveCompilationAssociationTestMap()
        {
            var compositionLvl1 = Guid.NewGuid();
            var bookingLvl2 = Guid.NewGuid();
            var compositionLvl3 = Guid.NewGuid();
            var booking = new Booking
            {
                Id = Guid.Empty,
                Composition = new Composition
                {
                    Id = compositionLvl1,
                    Name = "Test composition",
                    Booking = new Booking
                    {
                        Id = bookingLvl2,
                        Name = "New booking",
                        Composition = new Composition
                        {
                            Id = compositionLvl3,
                            Name = "Recent Composition"
                        }
                    }
                },
                Name = "Booking!"
            };

            var bookingViewModel = new BookingViewModel
            {
                Id = Guid.Empty,
                Composition = new CompositionViewModel
                {
                    Id = compositionLvl1,
                    Name = "Test composition",
                    Booking = new BookingViewModel
                    {
                        Id = bookingLvl2,
                        Name = "New booking",
                        Composition = new CompositionViewModel
                        {
                            Id = compositionLvl3,
                            Name = "Recent Composition"
                        }
                    }
                },
                Name = "Booking!"
            };
            return new KeyValuePair<Booking, BookingViewModel>(booking, bookingViewModel);
        }
Пример #32
0
 public void MakeReservationReturnsCorrectResult(BookingViewModel sut)
 {
     RequestReservationCommand actual = sut.MakeReservation();
     var expected = sut.AsSource().OfLikeness<RequestReservationCommand>().Without(d => d.Id);
     expected.ShouldEqual(actual);
 }