using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Nirvana.Common; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using YBDevice.Application; using YBDevice.Application.ViewInfo; using YBDevice.Entity; namespace YBDevice.NWeb.Pages.Info { /// /// 科普资讯 /// public class IndexModel : BaseModel { /// /// 类型列表 /// public List types; public List statuss = new List(); public List offs = new List(); private IInfoService _infoService; private IOfficialService _officialService; private IViewEngineService _viewEngineService; public ViewS2SDto viewdata = new ViewS2SDto(); public IndexModel(IInfoService infoService, IOfficialService officialService, IViewEngineService viewEngineService) { _infoService = infoService; _officialService = officialService; _viewEngineService = viewEngineService; } public async Task OnGetAsync() { var list = await _infoService.GetAllTypeAsync(); var offlist = await _officialService.GetAllListAsync(2); types = list.Select(x => new SelectListItem { Text = x.Name, Value = x.Id.ToString() }).ToList(); offs = offlist.Select(x => new SelectListItem { Text = x.nick_name, Value = x.authorizer_appid.ToString() }).ToList(); statuss = EnumHelper.GetEnumDictionary().Select(x => new SelectListItem { Value = x.Key.ToString(), Text = x.Value }).ToList(); viewdata = await _viewEngineService.GetBtnListAsync(); } } }