コード例 #1
0
 public ActionResult BillStatistics(DateTime?fromDate, DateTime?toDate)
 {
     try
     {
         ViewBag.tungay  = fromDate;
         ViewBag.denngay = toDate;
         var model = new ViewCountModel();
         model.total = context.BookingDetails.Where(x => x.StartDay >= fromDate && x.EndDay <= toDate).Sum(x => x.Total_Amount);
         return(View(model));
     }
     catch
     {
         return(View());
     }
 }
コード例 #2
0
 public ActionResult BookingStatistics(string roomTypeName, DateTime?fromDate, DateTime?toDate)
 {
     try
     {
         ViewBag.tungay       = fromDate;
         ViewBag.denngay      = toDate;
         ViewBag.tenloaiphong = roomTypeName;
         var model = new ViewCountModel();
         //var model = context.BookingDetails.Where(x => x.Room.Name == roomName && x.StartDay > fromDate && x.EndDay <= toDate).ToList();
         model.bookingCount = (from a in context.BookingDetails
                               where a.Room.RoomType.Name == roomTypeName && a.StartDay >= fromDate && a.EndDay <= toDate
                               select new { a.Id }).Count();
         return(View(model));
     }
     catch
     {
         return(View());
     }
 }