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.AppApi
{
    public class EditModel : BaseModel
    {
        private readonly IBusinessService _businessService;
        private readonly IBusinessApiService _businessApiService;

        public List<W_Business> blist = new List<W_Business>();

        public W_BusinessAppApi data = new W_BusinessAppApi();

        public EditModel(IBusinessService businessService, IBusinessApiService businessApiService)
        {
            _businessService = businessService;
            _businessApiService = businessApiService;
        }
        public async Task OnGetAsync(Guid? id=null)
        {
            blist = await _businessService.GetAllList();
            if(id.HasValue && id.Value != Guid.Empty)
            {
                data = await _businessApiService.DetailAsync(id.Value);
            }
        }
    }
}
