Exemplo n.º 1
0
        public void InsertBooking(UserFlightBookingDetail bookingDetail)
        {
            context.UserFlightBookingDetails.Add(bookingDetail);
            context.SaveChanges();
            var userEmail = "";

            userEmail = bookingDetail.UserEmail;

            MailRequest request = new MailRequest();

            request.ToEmail = userEmail;
            request.Subject = $"Spicejet Booking";
            request.Body    = $"<p style='color:green'> Dear,{bookingDetail.UserFirstName} {bookingDetail.UserMiddleName} {bookingDetail.UserLastName} Your Flight Booking Successfully Done  Your PNRNUMBER is :- {bookingDetail.PnrNumber}</p>";
            try
            {
                if (userEmail != null)
                {
                    mailService.SendEmailAsync(request);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 2
0
        public void UpdateBooking(UserFlightBookingDetail bookingDetail, int UserId)
        {
            var data = context.UserFlightBookingDetails.SingleOrDefault(s => s.UserId == UserId);

            data.UserFirstName     = bookingDetail.UserFirstName;
            data.UserMiddleName    = bookingDetail.UserMiddleName;
            data.UserLastName      = bookingDetail.UserLastName;
            data.UserContactNumber = bookingDetail.UserContactNumber;
            data.UserEmail         = bookingDetail.UserEmail;
            context.SaveChanges();
        }
 public ActionResult UpdateBooking(UserFlightBookingDetail bookingDetail, int UserId)
 {
     try
     {
         repository.UpdateBooking(bookingDetail, UserId);
         return(Ok("Booking Updated Successfully"));
     }
     catch (Exception e)
     {
         return(BadRequest(e));
     }
 }
 public ActionResult InsertBooking(UserFlightBookingDetail bookingDetail)
 {
     try
     {
         repository.InsertBooking(bookingDetail);
         return(Ok("Booking is Successfully Inserted"));
     }
     catch (Exception e)
     {
         return(BadRequest(e));
     }
 }