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 Checkout(int id, bool isEdit = true) { if (!Authentication.AuthenticateByCookie(HttpContext)) { return(Redirect("/Receptionists/Authentication/Login?are=Receptionists&ctrl=Activities&act=Checkout")); } ViewBag.isEdit = isEdit; BookingModel model = BookingDAO.GetBookingModel(id); return(View(model)); }
public IActionResult Checkin(int id, bool isEdit = true) { if (!Authentication.AuthenticateByCookie(HttpContext)) { return(Redirect("/Receptionists/Authentication/Login?are=Receptionists&ctrl=Activities&act=Checkin")); } ViewBag.isEdit = isEdit; BookingModel model = BookingDAO.GetBookingModel(id); if (StayDAO.GetALLGuestsOfBooking(id).Count == 0) { StayDAO.InsertStay(new Stay() { BookingID = model.BookingID, Status = null, FromDate = DateTime.Now, GuestID = model.Guest.GuestID, ToDate = null }); } return(View(model)); }