1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- using System.Collections.Generic;
- using System.Threading.Tasks;
- using GxPress.Repository.Interface.Navigation;
- using GxPress.Request.Navigation;
- using GxPress.Result.MiddleLable;
- using GxPress.Service.Interface.Navigation;
- using Microsoft.AspNetCore.Authorization;
- using Microsoft.AspNetCore.Mvc;
- namespace GxPress.Api.AdminControllers
- {
- /// <summary>
- /// 导航中间件
- /// </summary>
- [Route("api/admin/middle-label")]
- [ApiController]
- [Authorize]
- public class AdminMiddleLableController : ControllerBase
- {
- private readonly IMiddleLableRepository middleLableRepository;
- private readonly IMiddleLableService middleLableService;
- public AdminMiddleLableController(IMiddleLableRepository middleLableRepository, IMiddleLableService middleLableService)
- {
- this.middleLableRepository = middleLableRepository;
- this.middleLableService = middleLableService;
- }
- /// <summary>
- /// 列表
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public async Task<IEnumerable<Entity.Navigations.MiddleLable>> GetList()
- {
- return await middleLableRepository.GetAllAsync();
- }
- /// <summary>
- /// 详情
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- [HttpGet("{id}")]
- public async Task<MiddleLableResult> GetAsync(int id)
- {
- return await middleLableService.GetMiddleLableResultAsync(id);
- }
- /// <summary>
- /// 添加导航中间件
- /// </summary>
- /// /// <param name="request"></param>
- /// <returns></returns>
- [HttpPost]
- public async Task<bool> Insert(MiddleLableInRequest request)
- {
- return await middleLableService.InsertAsync(request);
- }
- /// <summary>
- /// 删除中间件页面
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- [HttpDelete("{id}")]
- public async Task<bool> Delete(int id)
- {
- return await middleLableService.DeleteAsync(id);
- }
- /// <summary>
- /// 修改导航中间件
- /// </summary>
- /// <param name="request"></param>
- /// <returns></returns>
- [HttpPut]
- public async Task<bool> Update(MiddleLableUpRequest request)
- {
- return await middleLableService.UpdateAsync(request);
- }
- }
- }
|