using Microsoft.AspNetCore.Mvc.Rendering; using Nirvana.Common; using YBDevice.Application; using YBDevice.Application.OrderInfo; using YBDevice.Entity; namespace YBDevice.NWeb.Pages.Order { public class EditModel : BaseModel { public YB_Order data = new YB_Order(); public List> types = new List>(); public List> bindtypes = new List>(); public List devicetypes = new List(); private IOrderService _orderService; private IDeviceService _deviceService; public EditModel(IOrderService orderService, IDeviceService deviceService) { _orderService = orderService; _deviceService = deviceService; } public async Task OnGetAsync(Guid? id) { var BaseUser = BaseInfoService.GetUserInfo(); if (BaseUser.AccountType != AccountType.platform) { types = EnumHelper.GetAllItemList().Where(x => x.Key == OrderType.Office).ToList(); bindtypes = EnumHelper.GetAllItemList().Where(x => x.Key != OrderBindType.UserBind).ToList(); } else { types = EnumHelper.GetAllItemList().Where(x => x.Key != OrderType.URL).ToList(); bindtypes = EnumHelper.GetAllItemList().ToList(); } devicetypes = await _deviceService.GetTypeListAsync(); if (id.HasValue && id.Value != Guid.Empty) { data = await _orderService.DetailAsync(id.Value); } } } }