public void Get_Returns_Specific_Reservation()
        {
            // Arrange
            LibraryContextMock    mockContext = new LibraryContextMock();
            ReservationRepository repo        = new ReservationRepository(mockContext);
            BookRepository        bookRepo    = new BookRepository(mockContext);
            Book newBook = new Book()
            {
                title       = "New title",
                author      = "New author",
                isbn        = "22222",
                publishDate = "2001"
            };
            Reservation newReservation1 = new Reservation()
            {
                id = 0, book = newBook
            };
            Reservation newReservation2 = new Reservation()
            {
                id = 1, book = newBook
            };

            bookRepo.Add(newBook);
            repo.Add(newReservation1);
            repo.Add(newReservation2);

            // Act
            Reservation Reservation = repo.Get(1);

            // Asert
            Assert.Equal(newReservation2, Reservation);
        }
        public void Add_Doesnt_Insert_If_Times_Clash()
        {
            // Arrange
            LibraryContextMock    mockContext = new LibraryContextMock();
            ReservationRepository repo        = new ReservationRepository(mockContext);
            BookRepository        bookRepo    = new BookRepository(mockContext);
            Book newBook = new Book()
            {
                title       = "New title",
                author      = "New author",
                isbn        = "22222",
                publishDate = "2001"
            };
            Reservation Reservation1 = new Reservation()
            {
                book      = newBook,
                startDate = new System.DateTime(2016, 1, 1, 1, 0, 0),
                endDate   = new System.DateTime(2016, 1, 1, 2, 0, 0),
            };
            Reservation Reservation2 = new Reservation()
            {
                book      = newBook,
                startDate = new System.DateTime(2016, 1, 1, 1, 30, 0),
                endDate   = new System.DateTime(2016, 1, 1, 2, 30, 0),
            };

            bookRepo.Add(newBook);
            repo.Add(Reservation1);
            Assert.Throws <InvalidOperationException>(() => repo.Add(Reservation2));
            IEnumerable <Reservation> Reservations = repo.GetAll();

            Assert.Equal(new Reservation[] { Reservation1 }, Reservations.ToArray());
        }
        public void Get_All_Returns_All_Reservations()
        {
            // Arrange
            LibraryContextMock    mockContext = new LibraryContextMock();
            ReservationRepository repo        = new ReservationRepository(mockContext);
            BookRepository        bookRepo    = new BookRepository(mockContext);
            Book newBook = new Book()
            {
                title       = "New title",
                author      = "New author",
                isbn        = "22222",
                publishDate = "2001"
            };
            Reservation newReservation1 = new Reservation()
            {
                book = newBook
            };
            Reservation newReservation2 = new Reservation()
            {
                book = newBook
            };

            bookRepo.Add(newBook);
            repo.Add(newReservation1);
            repo.Add(newReservation2);

            // Act
            IEnumerable <Reservation> Reservations = repo.GetAll();

            // Asert
            Assert.Equal(new Reservation[] { newReservation1, newReservation2 }, Reservations.ToArray());
        }
        public void WhenAddingReservationToRepoAddToUserAsWell()
        {
            Reservation testRes = new Reservation(_student, _room1, 4, _from, _to);

            _repoReserv.Add(testRes);

            List <Reservation> UsersReservations = _student.GetReservations();

            Assert.IsTrue(UsersReservations.Contains(testRes));
        }
Ejemplo n.º 5
0
        public IActionResult Create([FromBody] Reservation reservation, DateTime start, DateTime end)
        {
            StringValues headerValues;
            //Reservation reservation = new Reservation(startTime, endTime, courtId);
            var a = Request.Body;

            reservation.StartTime = start;
            reservation.EndTime   = end;

            if (Request.Headers.TryGetValue("Authorization", out headerValues))
            {
                string   token_str = headerValues.First();
                string[] token_arr = token_str.Split(" ");
                var      handler   = new JwtSecurityTokenHandler();
                var      token     = handler.ReadJwtToken(token_arr[1]);

                var userId = token.Payload["unique_name"];

                reservation.UserId = int.Parse(userId.ToString());

                return(Ok(_reservationRepository.Add(reservation)));
            }

            return(BadRequest());
        }
Ejemplo n.º 6
0
        public HotelMutation(ReservationRepository reservationRepository)
        {
            Field <ReservationType>("addReservation",
                                    arguments: new QueryArguments(new QueryArgument <NonNullGraphType <AddReservationInputType> > {
                Name = "reservation"
            }),

                                    resolve: context =>
            {
                var reservationInput = context.GetArgument <Reservation>("reservation");
                return(reservationRepository.Add(reservationInput));
            }
                                    );



            Field <ReservationType>("removeReservation",
                                    arguments: new QueryArguments(new QueryArgument <IntGraphType> {
                Name = "id"
            }),

                                    resolve: context =>
            {
                var id = context.GetArgument <int>("id");
                return(reservationRepository.Remove(id));
            }
                                    );
        }
Ejemplo n.º 7
0
        public async Task <Reservation> Reserve(String Name, String Email, String Country, int NoOfRooms, String RoomType,
                                                String MealPlanType, DateTime checkIn, DateTime checkOut, int TotalPrice, CancellationToken cancellationToken)
        {
            Guest       guest = AddGuest(Name, Email, Country);
            List <Room> rooms = await getFreeRooms(RoomType, checkIn, checkOut, cancellationToken);

            rooms = rooms.Take(NoOfRooms).ToList();
            MealPlan mealPlan = _mealPlanRepository.GetMealPlanByName(MealPlanType);
            RoomType roomType = Booking.converToEnum <RoomType>(RoomType);

            Reservation reservation = new Reservation
            {
                Guest     = guest,
                Rooms     = rooms,
                MealPlan  = mealPlan,
                RoomType  = roomType,
                StartDate = checkIn,
                EndDate   = checkOut,
                Price     = TotalPrice
            };

            _reservationRepository.Add(reservation);


            return(reservation);
        }
Ejemplo n.º 8
0
        // POST /api/employees/
        // body: JSON
        public IHttpActionResult Post([FromBody] dynamic data)
        {
            Random random = new Random();

            BookiAPI.DataAccessLayer.Models.Reservation reservation = new DataAccessLayer.Models.Reservation {
                ReservationNo = random.Next(1000000),
                DateTimeStart = Convert.ToDateTime(data.Reservation.DateTimeStart.Value),
                DateTimeEnd   = Convert.ToDateTime(data.Reservation.DateTimeEnd.Value),
                State         = 1,
                CustomerId    = (int)data.Reservation.CustomerId.Value,
                VenueId       = (int)data.Reservation.VenueId.Value,
                TableId       = (int)data.Reservation.TableId.Value,
                CreatedAt     = DateTime.Now,
                UpdatedAt     = DateTime.Now
            };

            if (IsTableAvailable(reservation.TableId, reservation.DateTimeStart, reservation.DateTimeEnd))
            {
                int reservationId = _reservationRepository.Add(reservation);

                if (reservationId > 0)
                {
                    return(Ok("" + reservationId));
                }
                else
                {
                    return(BadRequest("Something went wrong .."));
                }
            }
            else
            {
                return(BadRequest("That table is already booked!"));
            }
        }
 public ActionResult Add(Reservation item)
 {
     if (ModelState.IsValid)
     {
         repo.Add(item);
         return(RedirectToAction("Index"));
     }
     return(View("Index"));
 }
Ejemplo n.º 10
0
        public ActionResult AddReservation([FromBody] Reservation reservation)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            repo.Add(reservation);
            return(Accepted(reservation));
        }
Ejemplo n.º 11
0
        public void ReserveRoom()
        {
            foreach (IRoom room in Reservation.BestOption.RoomList)
            {
                room.Add(_reservation.ReservationPeriod);
            }

            _reservationRepository.Add(_reservation);
            DataManagementService.Instance.SaveData();
        }
        public void RoomIsNotAvailable()
        {
            DateTime    from = new DateTime(2017, 05, 01, 13, 0, 0);
            DateTime    to   = new DateTime(2017, 05, 01, 14, 0, 0);
            Reservation res  = new Reservation(_student, _room1, 3, from, to);

            _repoReserv.Add(res);
            bool roomAvailable = _room1.IsAvailable(from, to);

            Assert.IsFalse(roomAvailable);
        }
Ejemplo n.º 13
0
        internal void ReserveRoom(string date, string from, string to, IRoom room, string username)
        {
            IUser dummyUser = new User(username, "", Permission.Student);
            IUser user      = _repoUser.Get(dummyUser);

            string   dateTimeFrom = date + " " + from;
            DateTime dateFrom     = Convert.ToDateTime(dateTimeFrom);
            string   dateTimeTo   = date + " " + to;
            DateTime dateTo       = Convert.ToDateTime(dateTimeTo);

            _repoReservation.Add(user, room, 0, dateFrom, dateTo);
        }
        public void TestInitialize()
        {
            _repoRoom.Clear();
            _repoUser.Clear();
            _repoReservation.Clear();


            _reservationList = new List <Reservation>();

            _student = new User("matt2694", "*****@*****.**", Permission.Student);
            _teacher = new User("alhe", "*****@*****.**", Permission.Teacher);
            _admin   = new User("frje", "*****@*****.**", Permission.Admin);

            _room1 = new Room('A', 2, 9, 6, Permission.Student);
            _room2 = new Room('A', 2, 15, 6, Permission.Teacher);
            _room3 = new Room('A', 2, 115, 6, Permission.Admin);
            _room4 = new Room('A', 7, 5, 2, Permission.Student);
            _room5 = new Room('B', 7, 5, 10, Permission.Student);

            _repoUser.Add(_student);
            _repoUser.Add(_teacher);
            _repoUser.Add(_admin);

            _repoRoom.Add(_room1);
            _repoRoom.Add(_room2);
            _repoRoom.Add(_room3);
            _repoRoom.Add(_room4);
            _repoRoom.Add(_room5);

            _dateFrom = new DateTime(2016, 4, 29, 8, 0, 0);
            _dateTo   = new DateTime(2016, 4, 29, 16, 0, 0);

            _reservation1 = new Reservation(_student, _room1, 6, _dateFrom, _dateTo);
            _reservation2 = new Reservation(_teacher, _room2, 6, _dateFrom, _dateTo);
            _reservation3 = new Reservation(_admin, _room3, 6, _dateFrom, _dateTo);

            _repoReservation.Add(_reservation1);
            _repoReservation.Add(_reservation2);
            _repoReservation.Add(_reservation3);
        }
        public ActionResult Add(Reservation reservation)
        {
            if (ModelState.IsValid)
            {
                reservationRepository.Add(reservation);

                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                return(View(reservationRepository.Reservations));
            }
        }
        public void Delete_Removes_Correct_Reservation()
        {
            // Arrange
            LibraryContextMock    mockContext = new LibraryContextMock();
            ReservationRepository repo        = new ReservationRepository(mockContext);
            BookRepository        bookRepo    = new BookRepository(mockContext);
            Book newBook = new Book()
            {
                title       = "New title",
                author      = "New author",
                isbn        = "22222",
                publishDate = "2001"
            };
            Reservation newReservation1 = new Reservation()
            {
                id = 0, book = newBook
            };
            Reservation newReservation2 = new Reservation()
            {
                id = 1, book = newBook
            };
            Reservation newReservation3 = new Reservation()
            {
                id = 2, book = newBook
            };

            bookRepo.Add(newBook);
            repo.Add(newReservation1);
            repo.Add(newReservation2);
            repo.Add(newReservation3);

            // Act
            repo.Remove(1);
            IEnumerable <Reservation> Reservations = repo.GetAll();

            // Asert
            Assert.Equal(new Reservation[] { newReservation1, newReservation3 }, Reservations.ToArray());
        }
Ejemplo n.º 17
0
        public RedirectToActionResult CreateReservation(ReservationViewModel reservation)
        {
            if (reservation.CheckInDate < DateTime.Today)
            {
                return(RedirectToAction("ReservationLate"));
            }

            else if (reservation.CheckInDate == reservation.CheckOutDate)
            {
                return(RedirectToAction("ReservationTooShort"));
            }

            else if (reservation.CheckInDate > reservation.CheckOutDate)
            {
                return(RedirectToAction("ReservationWronglyScheduled"));
            }

            else if (context.Reservations.Where(x => x.CheckInDate == reservation.CheckInDate && x.Room.RoomID == reservation.Room.RoomID).Any())
            {
                return(RedirectToAction("ReservationExists"));
            }

            else
            {
                Models.Reservation reservationModel = new Models.Reservation();

                reservationModel.Room         = context.Rooms.FirstOrDefault(x => x.RoomID == reservation.Room.RoomID);
                reservationModel.UserName     = userManager.GetUserName(User);
                reservationModel.CheckInDate  = reservation.CheckInDate;
                reservationModel.CheckOutDate = reservation.CheckOutDate;
                reservationModel.TotalPrice   = reservation.TotalPrice;
                reservationModel.CountDays    = reservation.CountDays;

                if (reservationModel.CheckInDate.HasValue && reservationModel.CheckOutDate.HasValue)
                {
                    DateTime dt1 = reservationModel.CheckInDate.Value;
                    DateTime dt2 = reservationModel.CheckOutDate.Value;

                    reservationModel.CountDays = (dt2 - dt1).Days;

                    reservationModel.TotalPrice = reservationModel.CountDays * reservationModel.Room.Price;

                    Reservation newReservation = _reservationRepository.Add(reservationModel);
                    context.SaveChanges();
                }
            }
            return(RedirectToAction("MyReservation"));
        }
        // TODO: 1 - Create a channel factory for the Frequent Flyer service

        public string CreateReservation(ReservationDto request)
        {
            // Verify the flight is valid
            if (request.DepartureFlight == null)
            {
                throw new FaultException <ReservationCreationFault>(
                          new ReservationCreationFault
                {
                    Description     = "Reservation must include a departure flight",
                    ReservationDate = request.ReservationDate
                },
                          "Invalid flight info");
            }


            // Create reservation object with trips
            var reservation = new Reservation
            {
                TravelerId      = request.TravelerId,
                ReservationDate = request.ReservationDate,
                DepartureFlight = new Trip
                {
                    Class            = request.DepartureFlight.Class,
                    Status           = request.DepartureFlight.Status,
                    FlightScheduleID = request.DepartureFlight.FlightScheduleID
                }
            };

            if (request.ReturnFlight != null)
            {
                reservation.ReturnFlight = new Trip
                {
                    Class            = request.ReturnFlight.Class,
                    Status           = request.ReturnFlight.Status,
                    FlightScheduleID = request.ReturnFlight.FlightScheduleID
                };
            }

            using (IReservationRepository reservationRepository = new ReservationRepository(ConnectionName))
            {
                reservation.ConfirmationCode = ReservationUtils.GenerateConfirmationCode(reservationRepository);
                reservationRepository.Add(reservation);
                reservationRepository.Save();
                return(reservation.ConfirmationCode);
            }
        }
Ejemplo n.º 19
0
 private void BtnSave_Click(object sender, EventArgs e)
 {
     if (lstRooms.SelectedIndex > -1)
     {
         if (dtpFinishDate.Value > dtpStartDate.Value)
         {
             Reservation reservation = new Reservation();
             reservation.StartDate  = dtpStartDate.Value;
             reservation.FinishDate = dtpFinishDate.Value;
             reservation.CustomerID = currentCustomer.ID;
             reservation.RoomID     = room.ID;
             reservation.Amount     = Convert.ToDecimal(room.Price * Convert.ToDecimal((dtpFinishDate.Value - dtpStartDate.Value).TotalDays));
             reservationRepository.Add(reservation);
             LoadListBox();
         }
     }
 }
        private void btnCreateReservation_Click_1(object sender, EventArgs e)
        {
            int creator;

            try
            {
                Reservation rez = new Reservation();
                rez.CustomerID      = Convert.ToInt32(lblcustomer.Text);
                rez.TableID         = Convert.ToInt32(lbltable.Text);
                rez.ReservationDate = dtmPickDate.Value;
                creator             = Convert.ToInt32(lblStaffid.Text);
                rez.CreatorID       = creator;
                ReservationRepository rp = new ReservationRepository();
                rp.Add(rez);
            }
            catch
            {
                MessageBox.Show("Lütfen Bilglileri Doğru ve Düzgün Giriniz!");
            }
            Order order = new Order();

            order.TableID           = Convert.ToInt32(lbltable.Text);
            order.CustomerID        = Convert.ToInt32(lblcustomer.Text);
            creator                 = Convert.ToInt32(lblStaffid.Text);
            order.OrderTakerStaffID = creator;
            order.FoodStatusID      = 1002;
            order.PaymentStatusID   = 3;
            order.CreatorID         = creator;
            OrderRepository op = new OrderRepository();

            op.Add(order);
            try
            {
            }
            catch
            {
                MessageBox.Show("Hata!");
            }
        }
        public void Update_updates_Correct_Reservation()
        {
            // Arrange
            LibraryContextMock    mockContext = new LibraryContextMock();
            ReservationRepository repo        = new ReservationRepository(mockContext);
            BookRepository        bookRepo    = new BookRepository(mockContext);
            Book newBook = new Book()
            {
                title       = "New title",
                author      = "New author",
                isbn        = "22222",
                publishDate = "2001"
            };
            Reservation oldReservation = new Reservation()
            {
                book      = newBook,
                startDate = new System.DateTime(2016, 1, 1, 1, 0, 0),
                endDate   = new System.DateTime(2016, 1, 1, 2, 0, 0),
            };
            Reservation newReservation = new Reservation()
            {
                book      = newBook,
                startDate = new System.DateTime(2016, 1, 1, 3, 0, 0),
                endDate   = new System.DateTime(2016, 1, 1, 4, 0, 0),
            };

            bookRepo.Add(newBook);
            repo.Add(oldReservation);

            // Act
            repo.Update(newReservation, 0);
            IEnumerable <Reservation> Reservations = repo.GetAll();

            // Asert
            Assert.Equal(new Reservation[] { newReservation }, Reservations.ToArray());
        }
Ejemplo n.º 22
0
 public Reservation CreateReservation(Reservation item)
 {
     return(repo.Add(item));
 }
Ejemplo n.º 23
0
 public Reservation CreateReservation(Reservation item)
 {
     return(_reservationRepository.Add(item));
 }
Ejemplo n.º 24
0
        static void Main(string[] args)
        {
            BeverageRepository                _beverageRepository                = new BeverageRepository();
            CustomerRepository                _customerRepository                = new CustomerRepository();
            EmployeeRepository                _employeeRepository                = new EmployeeRepository();
            ReservationRepository             _reservationRepository             = new ReservationRepository();
            TablePackageRepository            _tablePackageRepository            = new TablePackageRepository();
            ReservationTablePackageRepository _reservationTablePackageRepository = new ReservationTablePackageRepository();
            TableRepository         _tableRepository         = new TableRepository();
            VenueHourRepository     _venueHourRepository     = new VenueHourRepository();
            VenueEmployeeRepository _venueEmployeeRepository = new VenueEmployeeRepository();
            VenueRepository         _venueRepository         = new VenueRepository();

            Console.WriteLine("Seeding database ..");
            _beverageRepository.Truncate();
            _reservationTablePackageRepository.Truncate();
            _reservationRepository.Truncate();
            _tablePackageRepository.Truncate();
            _tableRepository.Truncate();
            _venueHourRepository.Truncate();
            _venueEmployeeRepository.Truncate();
            _venueRepository.Truncate();
            _customerRepository.Truncate();
            _employeeRepository.Truncate();

            Console.WriteLine("Seeding venues ..");
            Venue venue = new Venue {
                Name    = "Kongebaren",
                Address = "Gammel Kongevej 1",
                Zip     = 9000,
                City    = "Aalborg"
            };

            venue.Id = _venueRepository.Add(venue);

            Venue venue1 = new Venue {
                Name    = "Dronningenbaren",
                Address = "Gammel Kongevej 2",
                Zip     = 9000,
                City    = "Aalborg"
            };

            venue1.Id = _venueRepository.Add(venue1);

            Console.WriteLine("Seeding employees ..");
            Employee employee0 = new Employee
            {
                Name       = "Kongen Kongessen",
                Phone      = "+4598765432",
                Email      = "*****@*****.**",
                Password   = HashingHelper.GenerateHash("12345678"),
                EmployeeNo = 1,
                Title      = "Kongen",
                Salt       = HashingHelper.RandomString(20)
            };
            Employee employee1 = new Employee
            {
                Name       = "Dronningen Dronningensen",
                Phone      = "+4509876543",
                Email      = "*****@*****.**",
                Password   = HashingHelper.GenerateHash("12345678"),
                EmployeeNo = 1,
                Title      = "Dronningen",
                Salt       = HashingHelper.RandomString(20),
            };

            Employee employee2 = new Employee {
                Name       = "Prins Prinsen",
                Phone      = "+4539847837",
                Email      = "*****@*****.**",
                Password   = HashingHelper.GenerateHash("12345678"),
                EmployeeNo = 1,
                Title      = "Prinsen",
                Salt       = HashingHelper.RandomString(20),
            };

            employee0.Id = _employeeRepository.Add(employee0);
            employee1.Id = _employeeRepository.Add(employee1);
            employee2.Id = _employeeRepository.Add(employee2);

            Console.WriteLine("Seeding venue employees ..");
            _venueEmployeeRepository.Add(new VenueEmployee
            {
                VenueId     = venue.Id,
                EmployeeId  = employee0.Id,
                AccessLevel = 1
            });
            _venueEmployeeRepository.Add(new VenueEmployee
            {
                VenueId     = venue1.Id,
                EmployeeId  = employee1.Id,
                AccessLevel = 1
            });

            _venueEmployeeRepository.Add(new VenueEmployee {
                VenueId     = venue.Id,
                EmployeeId  = employee2.Id,
                AccessLevel = 1
            });

            _venueEmployeeRepository.Add(new VenueEmployee {
                VenueId     = venue1.Id,
                EmployeeId  = employee2.Id,
                AccessLevel = 1
            });

            Console.WriteLine("Seeding customers ..");
            string   salt      = HashingHelper.RandomString(20);
            Customer customer0 = new Customer {
                Name       = "Kunde Kundessen",
                Phone      = "+4512345678",
                Email      = "*****@*****.**",
                Salt       = salt,
                Password   = HashingHelper.GenerateHashWithSalt("12345678", salt),
                CustomerNo = 1,
            };

            salt = HashingHelper.RandomString(20);
            Customer customer1 = new Customer
            {
                Name       = "Gæst Gæstessen",
                Phone      = "+4587654321",
                Email      = "*****@*****.**",
                Salt       = salt,
                Password   = HashingHelper.GenerateHashWithSalt("87654321", salt),
                CustomerNo = 2
            };

            customer0.Id = _customerRepository.Add(customer0);
            customer1.Id = _customerRepository.Add(customer1);

            Console.WriteLine("Seeding tables ..");
            Table table0 = new Table {
                NoOfSeats = 4,
                Name      = "Vinderbordet",
                VenueId   = venue.Id,
            };
            Table table1 = new Table
            {
                NoOfSeats = 6,
                Name      = "Taberbordet",
                VenueId   = venue.Id
            };
            Table table2 = new Table {
                NoOfSeats = 7,
                Name      = "Det gode bord",
                VenueId   = venue1.Id,
            };
            Table table3 = new Table {
                NoOfSeats = 3,
                Name      = "Det dårlige bord",
                VenueId   = venue1.Id
            };

            table0.Id = _tableRepository.Add(table0);
            table1.Id = _tableRepository.Add(table1);
            table2.Id = _tableRepository.Add(table2);
            table3.Id = _tableRepository.Add(table3);

            Console.WriteLine("Seeding table packages ..");
            TablePackage tablePackage0 = new TablePackage {
                Name    = "Den dyre",
                Price   = 6000,
                VenueId = venue.Id,
            };
            TablePackage tablePackage1 = new TablePackage
            {
                Name    = "Den billige",
                Price   = 500,
                VenueId = venue.Id
            };
            TablePackage tablePackage2 = new TablePackage {
                Name    = "Den Gode",
                Price   = 4000,
                VenueId = venue1.Id,
            };
            TablePackage tablePackage3 = new TablePackage {
                Name    = "Den Den Dårlige",
                Price   = 300,
                VenueId = venue1.Id
            };

            tablePackage0.Id = _tablePackageRepository.Add(tablePackage0);
            tablePackage1.Id = _tablePackageRepository.Add(tablePackage1);
            tablePackage2.Id = _tablePackageRepository.Add(tablePackage2);
            tablePackage3.Id = _tablePackageRepository.Add(tablePackage3);

            Console.WriteLine("Seeding reservations ..");
            Reservation reservation0 = new Reservation
            {
                ReservationNo = 10001,
                DateTimeStart = Convert.ToDateTime("28/12-2019 20:00"),
                DateTimeEnd   = Convert.ToDateTime("29/12-2019 05:00"),
                State         = 1,
                CustomerId    = customer0.Id,
                VenueId       = venue.Id,
                TableId       = table0.Id,
                CreatedAt     = DateTime.Now,
                UpdatedAt     = DateTime.Now
            };
            Reservation reservation1 = new Reservation
            {
                ReservationNo = 10002,
                DateTimeStart = Convert.ToDateTime("31/12-2019 20:00"),
                DateTimeEnd   = Convert.ToDateTime("01/01-2020 05:00"),
                State         = 1,
                CustomerId    = customer1.Id,
                VenueId       = venue1.Id,
                TableId       = table1.Id,
                CreatedAt     = DateTime.Now,
                UpdatedAt     = DateTime.Now
            };

            reservation0.Id = _reservationRepository.Add(reservation0);
            reservation1.Id = _reservationRepository.Add(reservation1);
            _reservationTablePackageRepository.Add(new ReservationTablePackage
            {
                ReservationId  = reservation0.Id,
                TablePackageId = tablePackage0.Id
            });
            _reservationTablePackageRepository.Add(new ReservationTablePackage
            {
                ReservationId  = reservation1.Id,
                TablePackageId = tablePackage1.Id
            });
        }
Ejemplo n.º 25
0
 public List <Reservation> AddTicket(Reservation item)
 {
     rrep.Add(item);
     rrep.Save();
     return(GetAllReservations());
 }
Ejemplo n.º 26
0
 public Reservation PostReservation(Reservation item)
 {
     return(repo.Add(item));
 }
Ejemplo n.º 27
0
 [HttpPost]                                                  //added attribute
 public Reservation CreateReservation(Reservation item)      //changed the method name form PostReservation
 {
     return(repo.Add(item));
 }
Ejemplo n.º 28
0
 public Reservation CreateReservation(Reservation reservation)
 {
     return(repo.Add(reservation));
 }
Ejemplo n.º 29
0
 public Reservation Post(Reservation item) => _repo.Add(item);
 public bool Add(Reservation reserves)
 {
     return(_reserveRepository.Add(reserves));
 }