2018-06-07 00:45:47 +08:00
|
|
|
|
using Bootstrap.DataAccess;
|
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using System.Collections.Generic;
|
2019-03-11 15:45:38 +08:00
|
|
|
|
using System.Linq;
|
2018-06-07 00:45:47 +08:00
|
|
|
|
|
|
|
|
|
namespace Bootstrap.Admin.Controllers.Api
|
|
|
|
|
{
|
2018-10-28 15:08:58 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 数据字典分类
|
|
|
|
|
/// </summary>
|
2019-03-11 15:45:38 +08:00
|
|
|
|
[Route("api/[controller]/[action]")]
|
2018-11-24 15:12:44 +08:00
|
|
|
|
[ApiController]
|
|
|
|
|
public class CategoryController : ControllerBase
|
2018-06-07 00:45:47 +08:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2018-10-28 15:08:58 +08:00
|
|
|
|
/// 获取字典表中所有Category数据
|
2018-06-07 00:45:47 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet]
|
|
|
|
|
[AllowAnonymous]
|
2019-03-11 15:45:38 +08:00
|
|
|
|
public IEnumerable<string> RetrieveDictCategorys()
|
2018-06-07 00:45:47 +08:00
|
|
|
|
{
|
|
|
|
|
return DictHelper.RetrieveCategories();
|
|
|
|
|
}
|
2019-03-11 15:45:38 +08:00
|
|
|
|
|
|
|
|
|
/// <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
|
|
|
|
}
|
|
|
|
|
}
|