MeiRiYiCheng_1_old/YBDevice.NWeb/Pages/Order/Edit.cshtml.cs

43 lines
1.7 KiB
C#

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<KeyValuePair<OrderType, string>> types = new List<KeyValuePair<OrderType, string>>();
public List<KeyValuePair<OrderBindType, string>> bindtypes = new List<KeyValuePair<OrderBindType, string>>();
public List<YB_DeviceType> devicetypes = new List<YB_DeviceType>();
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<OrderType>().Where(x => x.Key == OrderType.Office).ToList();
bindtypes = EnumHelper.GetAllItemList<OrderBindType>().Where(x => x.Key != OrderBindType.UserBind).ToList();
}
else
{
types = EnumHelper.GetAllItemList<OrderType>().Where(x => x.Key != OrderType.URL).ToList();
bindtypes = EnumHelper.GetAllItemList<OrderBindType>().ToList();
}
devicetypes = await _deviceService.GetTypeListAsync();
if (id.HasValue && id.Value != Guid.Empty)
{
data = await _orderService.DetailAsync(id.Value);
}
}
}
}