Exemple #1
0
        public IActionResult Update([FromBody] UpdateReservation request)
        {
            using (logger.BeginScope("Update Reservation"))
            {
                logger.LogInformation("Initiating reservation creation for {seatId}", request?.SeatId);

                if (request?.SeatId == null || request?.SeatId == Guid.Empty)
                {
                    logger.LogWarning(LogEvents.InvalidRequest, "Invalid {SeatId}", request?.SeatId);

                    return(BadRequest("Invalid SeatId"));
                }

                if (request?.ReservationId == null || request?.ReservationId == Guid.Empty)
                {
                    logger.LogWarning(LogEvents.InvalidRequest, "Invalid {ReservationId}", request?.ReservationId);

                    return(BadRequest("Invalid ReservationId"));
                }

                var reservation = repository.Find(request.ReservationId);

                reservation.SeatId = request.SeatId;

                if (!repository.Update(reservation))
                {
                    logger.LogWarning(LogEvents.EntityNotFound, "Seat with {SeatId} is already reserved", reservation.SeatId);

                    return(Conflict("Seat is already reserved"));
                }

                logger.LogInformation("Successfully updated reservation {ReservationId}", reservation.Id);
                return(Created("api/Reservations", reservation.Id));
            }
        }
        public ActionResult _UpdateReservation(GetUpdateReservation getUpdateReservation)
        {
            UpdateReservation updateReservation = getUpdateReservation.ExecuteItem();

            this.ViewData["SubmitLabel"] = "Next";
            return(View("FormPage", updateReservation));
        }
        private void BtnUpdateReservation_Click(object sender, EventArgs e)
        {
            UpdateReservation updateReservation = new UpdateReservation(currentUser, customer);

            this.Hide();
            updateReservation.Show();
        }
Exemple #4
0
        public async void UpdateReservation(
            EStatusCode expectedStatus,
            UpdateReservation mutation
            )
        {
            EntitiesFactory.NewAnnouncement(id: mutation.AnnouncementId).Save();
            if (expectedStatus != EStatusCode.NotFound)
            {
                EntitiesFactory.NewReservation(id: mutation.Id).Save();
            }
            if (expectedStatus == EStatusCode.Conflict)
            {
                EntitiesFactory.NewContact(phone: mutation.ContactPhone).Save();
            }

            var result = await MutationsHandler.Handle(mutation);

            Assert.Equal(expectedStatus, result.Status);
            if (expectedStatus == EStatusCode.Success)
            {
                var reservationDb = await MutationsDbContext.Reservations
                                    .Where(r => r.Id == mutation.Id)
                                    .FirstOrDefaultAsync();

                Assert.NotNull(reservationDb);
                Assert.Equal(mutation.AnnouncementId, reservationDb.AnnouncementId);
                Assert.Equal(mutation.ContactName, reservationDb.Contact.Name);
                Assert.Equal(mutation.ContactPhone, reservationDb.Contact.Phone);
            }
        }
        public void UpdateReservationTest()
        {
            // TODO: add unit test for the method 'UpdateReservation'
            string            reservationId = null; // TODO: replace null with proper value
            UpdateReservation value         = null; // TODO: replace null with proper value

            instance.UpdateReservation(reservationId, value);
        }
        public ActionResult _UpdateReservation(UpdateReservation updateReservation)
        {
            if (this.ModelState.IsValid)
            {
                updateReservation.ExecuteNonQuery();
                return(Redirect($"/providers/reservation/_UpdateReservation/{updateReservation.Id}"));
            }

            this.ViewData["SubmitLabel"] = "Next";
            return(View("FormPage", updateReservation));
        }
        public HttpResponseMessage UpdateReservation(UpdateReservation UpdateReservation)
        {
            int ret = repository.UpdateReservation(pclsCache, UpdateReservation.DoctorId, UpdateReservation.PatientId, UpdateReservation.Status, UpdateReservation.revUserId, UpdateReservation.TerminalName, new CommonFunction().getRemoteIPAddress(), UpdateReservation.DeviceType);

            return(new ExceptionHandler().SetData(Request, ret));
        }
 public async Task <ActionResult <MutationResult> > PutAsync(string id, [FromBody] UpdateReservation mutation)
 {
     mutation.Id = id;
     return(GetResult(await _mutationsHanlder.Handle(mutation)));
 }
Exemple #9
0
 public void Init()
 {
     instance = new UpdateReservation();
 }