コード例 #1
0
        // GET: Admin/Home
        public ActionResult Index()
        {
            double totalEarning = 0;
            var    book         = _booksManagement.Get(d => d.ID == 7);
            var    booksList    = _booksManagement.GetAll(b => DateTime.Equals(b.ArrivalDate, DateTime.Today) && !b.IsCancelled && !b.IsCheckIn).OrderBy(m => m.BookingDate).ToList();
            var    allBooksList = _booksManagement.GetAll(d => !d.IsCancelled).ToList();

            foreach (var item in allBooksList)
            {
                totalEarning += ((float)item.Price * (1 - item.Discount) * item.Night);
            }

            HomeViewModel model = new HomeViewModel
            {
                ContactFormsList = _contactFormsManagement.GetAll().OrderByDescending(m => m.SendedAt).Take(8).ToList(),
                BooksList        = booksList.ToList(),
                CustomerCount    = _customersManagement.GetAll().Count(),
                BookingCount     = _booksManagement.GetAll().Count(),
                RoomCount        = _roomsManagement.GetAll().Count(),
                TotalEarning     = totalEarning,
                RoomTypeList     = _roomTypesManagement.GetAll().ToList(),
                TestimonialList  = _testimonialsManagement.GetAll(t => t.IsShow == true).OrderBy(t => t.OrderSort).ToList()
            };

            return(View(model));
        }
コード例 #2
0
        // GET: Admin/CustomerManagement
        public ActionResult Index()
        {
            ShowCustomerViewModel model = new ShowCustomerViewModel()
            {
                CustomerList = _customersManagement.GetAll().OrderBy(d => d.Name).ToList()
            };

            return(View(model));
        }
コード例 #3
0
        public ActionResult NewReservation(int?id)
        {
            NewReservationViewModel model = new NewReservationViewModel()
            {
                RoomList     = _roomsManagement.GetAll().ToList(),
                RoomTypeList = _roomTypesManagement.GetAll().ToList(),
                CustomerList = _customersManagement.GetAll().OrderBy(c => c.Name).ToList()
            };

            if (id == null)
            {
                model.Book = new Books();
            }
            else
            {
                model.Book = _booksManagement.Get(d => d.ID == id);
            }

            return(View(model));
        }