public void TestCancellationRequest()
        {
            var request = new CancellationRequest { BookingNumber = "D35F673C-728F-447C-9872-F6F8D05CE0C7", ConfirmationNumber = "100", LastName = "Narayanappa" };
            var response = new WorkerRepository().CancelBooking(request);

            Assert.IsNotNull(response);
        }
Пример #2
0
 public CancellationResponse Cancel(CancellationRequest request)
 {
     return new CancellationResponse {
         ConfirmationNumber = request.ConfirmationNumber,
         BookingNumber = request.BookingNumber,
         StatusCode = BookingStatus.Cancelled
     };
 }
Пример #3
0
        public CancellationResponse CancelBooking(CancellationRequest request)
        {
            var response = new CancellationResponse();
            try
            {
                using (var context = new SpartanHotelsEntities())
                {
                    var userReservations =
                        context.Reservations.Where(
                            rs =>
                            (rs.ConfirmationNum.ToString() == request.ConfirmationNumber &&
                             rs.BookStatusID == (int) BookingStatus.Confirmed));

                    if (userReservations.Any())
                    {
                        foreach (var reservation in userReservations)
                            reservation.BookStatusID = (int) BookingStatus.Cancelled;
                        context.SaveChanges();
                    }
                    else
                    {
                        //return.. invalid input, confirmation doesnt exists
                    }
                }
            }
            catch (Exception)
            {

                throw;
            }
            return response;
        }
Пример #4
0
 public JsonResult Cancel(CancellationRequest request)
 {
     return Json(canceller.Cancel(request));
 }
Пример #5
0
        public CancellationResponse CancelBooking(CancellationRequest request)
        {
            var dbAccess = new DbAccess();

            return dbAccess.CancelBooking(request);
        }