29 lines
1.1 KiB
C#
29 lines
1.1 KiB
C#
using Asp.Versioning;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Umbraco.Cms.Core.Models;
|
|
using Umbraco.Cms.Core.Services;
|
|
using Umbraco.Cms.Api.Common.ViewModels.Pagination;
|
|
using Umbraco.Cms.Api.Management.ViewModels.Tree;
|
|
|
|
namespace Umbraco.Cms.Api.Management.Controllers.Dictionary.Tree;
|
|
|
|
[ApiVersion("1.0")]
|
|
public class RootDictionaryTreeController : DictionaryTreeControllerBase
|
|
{
|
|
public RootDictionaryTreeController(IEntityService entityService, IDictionaryItemService dictionaryItemService)
|
|
: base(entityService, dictionaryItemService)
|
|
{
|
|
}
|
|
|
|
[HttpGet("root")]
|
|
[MapToApiVersion("1.0")]
|
|
[ProducesResponseType(typeof(PagedViewModel<NamedEntityTreeItemResponseModel>), StatusCodes.Status200OK)]
|
|
public async Task<ActionResult<PagedViewModel<NamedEntityTreeItemResponseModel>>> Root(int skip = 0, int take = 100)
|
|
{
|
|
PagedModel<IDictionaryItem> paginatedItems = await DictionaryItemService.GetPagedAsync(null, skip, take);
|
|
|
|
return Ok(PagedViewModel(await MapTreeItemViewModels(null, paginatedItems.Items), paginatedItems.Total));
|
|
}
|
|
}
|