123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- using System.Collections.Generic;
- using System.Threading.Tasks;
- using GxPress.Auth;
- using GxPress.Repository.Interface;
- using GxPress.Request.App.Middle;
- using GxPress.Request.NoticeFolder;
- using GxPress.Result.NoticeFolder;
- using GxPress.Service.Interface.Middle;
- using Microsoft.AspNetCore.Mvc;
- namespace GxPress.Api.AppControllers
- {
- /// <summary>
- /// 通知文件夹
- /// </summary>
- [Route("api/app/notice-folder")]
- [ApiController]
- public class NoticeFolderController : ControllerBase
- {
- private readonly INoticeFolderRepository _noticeFolderRepository;
- private readonly ILoginContext _loginContext;
- private readonly IMiddleService _middleService;
- public NoticeFolderController(INoticeFolderRepository noticeFolderRepository, ILoginContext loginContext,
- IMiddleService middleService)
- {
- _noticeFolderRepository = noticeFolderRepository;
- _loginContext = loginContext;
- _middleService = middleService;
- }
- /// <summary>
- /// 创建通知文件夹
- /// </summary>
- /// <param name="request"></param>
- /// <returns></returns>
- [HttpPut("add")]
- public async Task<bool> Insert(NoticeFolderInRequest request)
- {
- request.UserId = _loginContext.AccountId;
- var middleInsertRequest = new MiddleInsertRequest
- {
- FolderName = request.FolderName,
- FolderType = 1,
- ParentId = request.ParentId,
- UserId = request.UserId
- };
- return await _middleService.InsertAsync(middleInsertRequest) > 0;
- }
- ///// <summary>
- ///// 删除通知文件夹
- ///// </summary>
- ///// <param name="id"></param>
- ///// <returns></returns>
- //[HttpDelete("{id}")]
- //public async Task<bool> Delete(int id)
- //{
- // return await _noticeFolderRepository.DeleteAsync(id);
- //}
- ///// <summary>
- ///// 修改通知文件夹
- ///// </summary>
- ///// <param name="request"></param>
- ///// <returns></returns>
- //[HttpPost("update")]
- //public async Task<bool> Update(NoticeFolderUpRequest request)
- //{
- // return await _noticeFolderRepository.UpdateAsync(request);
- //}
- ///// <summary>
- ///// 插入通知文件夹
- ///// </summary>
- ///// <param name="request"></param>
- ///// <returns></returns>
- //[HttpPost("add-notice")]
- //public async Task<bool> InsertNotice(NoticeFolderInNoticeRequest request)
- //{
- // return await _noticeFolderRepository.InsertNoticeAsync(request);
- //}
- ///// <summary>
- ///// 文件夹移除通知
- ///// </summary>
- ///// <param name="request"></param>
- ///// <returns></returns>
- //[HttpPost("remove-notice")]
- //public async Task<bool> NoticeFolderDeleteNotice(NoticeFolderDeleteNoticeRequest request)
- //{
- // return await _noticeFolderRepository.NoticeFolderDeleteNoticeAsync(request);
- //}
- /// <summary>
- /// 获取通知文件夹
- /// </summary>
- /// <returns></returns>
- [HttpPost("find")]
- public async Task<IEnumerable<NoticeFolderFindResult>> GetNoticeFolderByUserId(NoticeFolderFindRequest request)
- {
- request.UserId = _loginContext.AccountId;
- return await _noticeFolderRepository.GetNoticeFolderByUserIdAsync(request);
- }
- ///// <summary>
- ///// 设置文件夹置顶
- ///// </summary>
- ///// <param name="request"></param>
- ///// <returns></returns>
- //[HttpPost("set-is-top")]
- //public async Task<bool> SetNoticeFolderIsTop(NoticeFolderFindRequest request)
- //{
- // return await _noticeFolderRepository.SetNoticeFolderIsTopAsync(request);
- //}
- }
- }
|