54 lines
1.9 KiB
C#
54 lines
1.9 KiB
C#
using Microsoft.AspNetCore.Mvc.Rendering;
|
|
using Nirvana.Common;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using YBDevice.Application;
|
|
using YBDevice.Entity;
|
|
|
|
namespace YBDevice.NWeb.Pages.Banner
|
|
{
|
|
/// <summary>
|
|
/// ¹ã¸æ±à¼
|
|
/// </summary>
|
|
public class EditModel : BaseModel
|
|
{
|
|
public BannerSubmitModel data = new BannerSubmitModel();
|
|
public List<SelectListItem> types = new List<SelectListItem>();
|
|
public List<SelectListItem> ptypes = new List<SelectListItem>();
|
|
public List<YB_OfficlaAccount> offlist = new List<YB_OfficlaAccount>();
|
|
public List<YB_DeviceType> devicetypes = new List<YB_DeviceType>();
|
|
private IAdService _infoService;
|
|
private IOfficialService _officialService;
|
|
private IDeviceService _deviceService;
|
|
public EditModel(IAdService infoService,IOfficialService officialService, IDeviceService deviceService)
|
|
{
|
|
_infoService = infoService;
|
|
_officialService = officialService;
|
|
_deviceService = deviceService;
|
|
}
|
|
public async Task OnGetAsync(int id=0)
|
|
{
|
|
types = EnumHelper.GetEnumDictionary<AdType>().Select(x => new SelectListItem
|
|
{
|
|
Value = x.Key.ToString(),
|
|
Text = x.Value
|
|
}).ToList();
|
|
ptypes = EnumHelper.GetEnumDictionary<AdPositionType>()
|
|
.Where(x=>x.Key != 2)
|
|
.Select(x => new SelectListItem
|
|
{
|
|
Value = x.Key.ToString(),
|
|
Text = x.Value
|
|
}).ToList();
|
|
devicetypes = await _deviceService.GetTypeListAsync();
|
|
offlist = await _officialService.GetAllListAsync(2);
|
|
if (id > 0)
|
|
{
|
|
data = await _infoService.DetailAsync(id);
|
|
}
|
|
}
|
|
}
|
|
}
|