using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; namespace Waste.Web.Entry.Pages.Result { public class GlobalConfigModel : PageModel { private readonly ResultColumnConfigService columnConfigService; public GlobalConfigModel(ResultColumnConfigService columnConfigService) { this.columnConfigService = columnConfigService; } public async Task OnGetAsync() { Column = (await columnConfigService.GetGlobalColumn()).Select(x => new GlobalColumnConfigOutput { SystemTitle = ResultColumnConfigService.SystemColumn[x.Name], Name = x.Name, Title = x.Title, IsShow = x.IsShow }); } public async Task OnPostUpdateConfigAsync([FromBody] List input) { await columnConfigService.WriteGlobalConfig(input); //await service.UpdateAccountConfig(Baseuser.UserId, config); return Content("ok"); } public IEnumerable Column { get; set; } public class GlobalColumnConfigOutput : GlobalColumnConfig { public string SystemTitle { get; set; } } } }