Waste/Waste.Web.Entry/Pages/Menu/MenuEdit.cshtml.cs

34 lines
984 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Nirvana.Common;
using Waste.Application;
using Waste.Domain;
namespace Waste.Web.Entry.Pages.Menu
{
public class MenuEditModel : BaseModel
{
public W_Menu menu = new W_Menu();
public List<TreeSelectModel> list = new List<TreeSelectModel>();
private readonly ISystemService _systemService;
public MenuEditModel(ISystemService systemService)
{
_systemService = systemService;
}
public async Task OnGetAsync(Guid? id=null)
{
var data = await _systemService.GetMenuTreeJson(null);
list = data.ToObject<List<TreeSelectModel>>();
if (id.HasValue && id.Value != Guid.Empty)
{
menu = await _systemService.MenuDetailAsync(id.Value);
}
}
}
}