public IActionResult Confirmation(int RoomID, DateTime CheckInDate, DateTime CheckOutDate) { ViewData.Model = RoomsDAO.GetRoomModel(RoomID); ViewBag.CheckInDate = CheckInDate.ToString("MM-dd-yyyy", CultureInfo.InvariantCulture); ViewBag.CheckOutDate = CheckOutDate.ToString("MM-dd-yyyy", CultureInfo.InvariantCulture); return(View()); }
public async Task <IActionResult> Create(int RoomID, DateTime CheckInDate, DateTime CheckOutDate, Guest guest, Payment payment, int Amount) { int guestid = GuestDAO.InsertGuest(guest); int paymentid = PaymentDAO.InsertPayment(payment); int bookingid = BookingDAO.InsertBooking(new Booking() { RoomID = RoomID, CheckInDate = CheckInDate.AddHours(14), CheckOutDate = CheckOutDate.AddHours(12).AddMinutes(5), GuestID = guestid, Amount = (int)(CheckOutDate - CheckInDate).TotalDays * RoomsDAO.GetRoomModel(RoomID).RoomType.Price, PaymentID = paymentid, }); var model = BookingDAO.GetBookingModel(bookingid); string body = await Utlities.RenderViewToStringAsync <BookingModel>(this, "~/Areas/Guests/Views/Partial/_ConfirmEmail.cshtml", model); MailMessage mail = new MailMessage(); mail.From = new MailAddress("*****@*****.**"); mail.To.Add(guest.Email); mail.Subject = "Congratulations on your successful booking"; mail.Body = body; mail.IsBodyHtml = true; Utlities.SendEmail(mail); return(View()); }
public IActionResult Index(int RoomID, DateTime CheckInDate, DateTime CheckOutDate) { ViewBag.CheckInDate = CheckInDate; ViewBag.CheckOutDate = CheckOutDate; ViewBag.CheckInDateFormated = CheckInDate.ToString("MM-dd-yyyy", CultureInfo.InvariantCulture); ViewBag.CheckOutDateFormated = CheckOutDate.ToString("MM-dd-yyyy", CultureInfo.InvariantCulture); RoomModel rm = RoomsDAO.GetRoomModel(RoomID); ViewBag.Room = rm; //ViewBag.TotalPrice = (CheckOutDate - CheckInDate).TotalDays * PriceDAO.GetPrice(rm.RoomType.RoomTypeID, rm.OtherType.OtherTypeID); return(View()); }
public IActionResult Create(int RoomID, DateTime CheckInDate, DateTime CheckOutDate, Guest guest, Payment payment, int Amount) { int guestid = GuestDAO.InsertGuest(guest); int paymentid = PaymentDAO.InsertPayment(payment); int bookingid = BookingDAO.InsertBooking(new Booking() { RoomID = RoomID, CheckInDate = CheckInDate.AddHours(14), CheckOutDate = CheckOutDate.AddHours(12).AddMinutes(5), GuestID = guestid, Amount = (int)(CheckOutDate - CheckInDate).TotalDays * RoomsDAO.GetRoomModel(RoomID).RoomType.Price, PaymentID = paymentid, }); return(View()); }