Example #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));
        }
        public ActionResult NewTestimonial(NewTestimonialViewModel model)
        {
            var customerid = _bookManagement.Get(b => b.ID == model.Testimonial.BookID).CustomerID;

            model.Testimonial.CustomerID = customerid;

            model.Testimonial.IsShow = ConvertHelpers.ConvertIntToBool(model.ShowingStatus);

            _testimonialsManagement.AddOrUpdate(model.Testimonial);
            this.SuccessMessage("This testimonial has been saved!");

            return(RedirectToAction("Index", "TestimonialManagement"));
        }
Example #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));
        }