|
|
|
@ -5,8 +5,12 @@ using AutoMapper; |
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
using Microsoft.AspNetCore.Mvc.RazorPages; |
|
|
|
using Volo.Abp.Domain.Entities; |
|
|
|
using Volo.Abp.Features; |
|
|
|
using Volo.Abp.GlobalFeatures; |
|
|
|
using Volo.Abp.ObjectExtending; |
|
|
|
using Volo.CmsKit.Admin.Menus; |
|
|
|
using Volo.CmsKit.Features; |
|
|
|
using Volo.CmsKit.GlobalFeatures; |
|
|
|
using Volo.CmsKit.Menus; |
|
|
|
|
|
|
|
namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.Menus.MenuItems; |
|
|
|
@ -14,6 +18,7 @@ namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.Menus.MenuItems; |
|
|
|
public class UpdateModalModel : CmsKitAdminPageModel |
|
|
|
{ |
|
|
|
protected IMenuItemAdminAppService MenuAdminAppService { get; } |
|
|
|
protected IFeatureChecker FeatureChecker { get; } |
|
|
|
|
|
|
|
[BindProperty] |
|
|
|
public MenuItemUpdateViewModel ViewModel { get; set; } |
|
|
|
@ -22,16 +27,23 @@ public class UpdateModalModel : CmsKitAdminPageModel |
|
|
|
[BindProperty(SupportsGet = true)] |
|
|
|
public Guid Id { get; set; } |
|
|
|
|
|
|
|
public UpdateModalModel(IMenuItemAdminAppService menuAdminAppService) |
|
|
|
public bool IsPageFeatureEnabled { get; set; } |
|
|
|
|
|
|
|
public UpdateModalModel(IMenuItemAdminAppService menuAdminAppService, IFeatureChecker featureChecker) |
|
|
|
{ |
|
|
|
MenuAdminAppService = menuAdminAppService; |
|
|
|
FeatureChecker = featureChecker; |
|
|
|
IsPageFeatureEnabled = GlobalFeatureManager.Instance.IsEnabled<PagesFeature>(); |
|
|
|
} |
|
|
|
|
|
|
|
public async Task OnGetAsync() |
|
|
|
{ |
|
|
|
var menuItemDto = await MenuAdminAppService.GetAsync(Id); |
|
|
|
|
|
|
|
ViewModel = ObjectMapper.Map<MenuItemDto, MenuItemUpdateViewModel>(menuItemDto); |
|
|
|
IsPageFeatureEnabled = GlobalFeatureManager.Instance.IsEnabled<PagesFeature>() |
|
|
|
&& await FeatureChecker.IsEnabledAsync(CmsKitFeatures.PageEnable); |
|
|
|
|
|
|
|
ViewModel = ObjectMapper.Map<MenuItemWithDetailsDto, MenuItemUpdateViewModel>(menuItemDto); |
|
|
|
} |
|
|
|
|
|
|
|
public async Task<IActionResult> OnPostAsync() |
|
|
|
@ -43,8 +55,6 @@ public class UpdateModalModel : CmsKitAdminPageModel |
|
|
|
return new OkObjectResult(result); |
|
|
|
} |
|
|
|
|
|
|
|
[AutoMap(typeof(MenuItemDto))] |
|
|
|
[AutoMap(typeof(MenuItemUpdateInput), ReverseMap = true)] |
|
|
|
public class MenuItemUpdateViewModel : ExtensibleObject, IHasConcurrencyStamp |
|
|
|
{ |
|
|
|
[Required] |
|
|
|
@ -52,6 +62,7 @@ public class UpdateModalModel : CmsKitAdminPageModel |
|
|
|
|
|
|
|
public bool IsActive { get; set; } |
|
|
|
|
|
|
|
[Required] |
|
|
|
public string Url { get; set; } |
|
|
|
|
|
|
|
public string Icon { get; set; } |
|
|
|
@ -64,6 +75,8 @@ public class UpdateModalModel : CmsKitAdminPageModel |
|
|
|
|
|
|
|
public Guid? PageId { get; set; } |
|
|
|
|
|
|
|
public string? PageTitle { get; set; } |
|
|
|
|
|
|
|
[HiddenInput] |
|
|
|
public string ConcurrencyStamp { get; set; } |
|
|
|
} |
|
|
|
|