public IActionResult Report(AutoBookings autoBookings)
        {
            DateTime date1;
            DateTime date2;
            var      totalday = 0.0;

            var amount       = 0.0;
            var Totalamount  = 0.0;
            var cartrooms    = HttpContext.Session.GetObject <List <ItemofRoom> >("cart");
            var customerName = HttpContext.Session.GetString("customerName");

            if (customerName != null)
            {
                ViewBag.customerName = customerName;
            }
            foreach (var item in cartrooms)
            {
                amount = amount + item.Room.Price;
            }
            //foreach (var item in book)

            date1 = Convert.ToDateTime(autoBookings.CheckInTime);
            date2 = Convert.ToDateTime(autoBookings.CheckOutTime);
            TimeSpan ts = date2 - date1;

            totalday = ts.TotalDays;

            Totalamount         = totalday * amount;
            ViewBag.totalamount = Totalamount;
            return(View(cartrooms));
        }
        public async Task <IActionResult> AutoBooking(AutoBookings autoBookings)
        {
            var cartrooms  = HttpContext.Session.GetObject <List <ItemofRoom> >("cart");
            var customerId = HttpContext.Session.GetInt32("customerId");

            HttpContext.Session.SetObject("date", autoBookings);
            List <Booking> book = new List <Booking>();

            if (ModelState.IsValid)
            {
                if (customerId != null)
                {
                    foreach (var item in cartrooms)
                    {
                        var     roomId = item.Room.id;
                        Booking bk     = new Booking();
                        bk.RoomId       = roomId;
                        bk.BookingDate  = autoBookings.BookingDate;
                        bk.CheckInTime  = autoBookings.CheckInTime;
                        bk.CheckOutTime = autoBookings.CheckOutTime;
                        bk.CustomerId   = Convert.ToInt32(customerId);

                        _context.Add(bk);
                        await _context.SaveChangesAsync();
                    }


                    return(RedirectToAction("Report", autoBookings));
                }
                else
                {
                    return(NotFound());
                }
            }
            return(View());
        }