using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Waste.Application;
using Waste.Domain;

namespace Waste.Web.Entry.Pages.CountInfo
{
    public class IndexModel : PageModel
    {
        public string defaulttime = "";
        public List<W_Business> businesslist = new List<W_Business>();
        public List<W_WasteType> wastetypelist = new List<W_WasteType>();
        public BusinessReport data = new BusinessReport();
        private IBusinessService _businessService;
        private IWasteService _wasteService;
        public IndexModel(IBusinessService businessService,IWasteService wasteService)
        {
            _businessService = businessService;
            _wasteService = wasteService;
        }
        public async Task OnGetAsync()
        {
            defaulttime = $"{DateTime.Now.AddDays(-7).ToString("yyyy/MM/dd")} ~ {DateTime.Now.AddDays(-1).ToString("yyyy/MM/dd")}";
            businesslist = await _businessService.GetAllList();
            wastetypelist = await _wasteService.GetAllTypeList();
            data = await _businessService.GetBusinessTotalInfo();
        }
    }
}
