using Microsoft.AspNetCore.Mvc.Rendering;
using Nirvana.Common;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using YBDevice.Application.ViewInfo;
using YBDevice.Entity;

namespace YBDevice.NWeb.Pages.Banner
{
    /// <summary>
    /// 轮播图、开屏广告管理
    /// </summary>
    public class IndexModel : BaseModel
    {
        public List<SelectListItem> types = new List<SelectListItem>();
        public List<SelectListItem> ptypes = new List<SelectListItem>();
        public List<SelectListItem> statuss = new List<SelectListItem>();
        private IViewEngineService _viewEngineService;
        public ViewS2SDto viewdata = new ViewS2SDto();
        public IndexModel(IViewEngineService viewEngineService)
        {
            _viewEngineService = viewEngineService;
        }
        public async Task OnGetAsync()
        {
            statuss = EnumHelper.GetEnumDictionary<AdStatus>().Select(x => new SelectListItem
            {
                Value = x.Key.ToString(),
                Text = x.Value
            }).ToList();
            types = EnumHelper.GetEnumDictionary<AdType>().Select(x => new SelectListItem
            {
                Value = x.Key.ToString(),
                Text = x.Value
            }).ToList();
            ptypes = EnumHelper.GetEnumDictionary<AdPositionType>().Select(x => new SelectListItem
            {
                Value = x.Key.ToString(),
                Text = x.Value
            }).ToList();
            viewdata = await _viewEngineService.GetBtnListAsync();
        }
    }
}
