BootstrapAdmin/Bootstrap.Admin/Controllers/Api/CategoryController.cs

48 lines
1.3 KiB
C#
Raw Normal View History

2018-06-07 00:45:47 +08:00
using Bootstrap.DataAccess;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Linq;
2018-06-07 00:45:47 +08:00
namespace Bootstrap.Admin.Controllers.Api
{
/// <summary>
/// 数据字典分类
/// </summary>
[Route("api/[controller]/[action]")]
[ApiController]
public class CategoryController : ControllerBase
2018-06-07 00:45:47 +08:00
{
/// <summary>
/// 获取字典表中所有Category数据
2018-06-07 00:45:47 +08:00
/// </summary>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
public IEnumerable<string> RetrieveDictCategorys()
2018-06-07 00:45:47 +08:00
{
return DictHelper.RetrieveCategories();
}
/// <summary>
///
/// </summary>
/// <returns></returns>
[HttpGet]
public IEnumerable<string> RetrieveMenus()
{
return MenuHelper.RetrieveAllMenus(User.Identity.Name).OrderBy(m => m.Name).Select(m => m.Name);
}
/// <summary>
///
/// </summary>
/// <returns></returns>
[HttpGet]
public IEnumerable<string> RetrieveParentMenus()
{
return MenuHelper.RetrieveMenus(User.Identity.Name).Where(m => m.Menus.Count() > 0).OrderBy(m => m.Name).Select(m => m.Name);
}
2018-06-07 00:45:47 +08:00
}
}