|
@@ -11,6 +11,7 @@ using Hotline.Share.Enums.Order;
|
|
|
using Hotline.Share.Enums.Settings;
|
|
|
using MapsterMapper;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
+using NPOI.OpenXmlFormats.Vml;
|
|
|
using SqlSugar;
|
|
|
using StackExchange.Redis;
|
|
|
using XF.Domain.Exceptions;
|
|
@@ -205,6 +206,37 @@ namespace Hotline.Api.Controllers
|
|
|
await _eventCategoryRepository.RemoveRangeAsync(list, HttpContext.RequestAborted);
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 修改事件
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("event/modify-event")]
|
|
|
+ public async Task ModifyEventCategory([FromBody] ModifyEventCategoryDto dto)
|
|
|
+ {
|
|
|
+ var model = await _eventCategoryRepository.GetAsync(dto.Id, HttpContext.RequestAborted);
|
|
|
+ if (model == null)
|
|
|
+ throw UserFriendlyException.SameMessage("无效数据");
|
|
|
+
|
|
|
+ model.EventName = dto.EventName;
|
|
|
+ model.EventFullName = dto.EventFullName;
|
|
|
+ model.OrderBy = dto.OrderBy;
|
|
|
+ await _eventCategoryRepository.UpdateAsync(model, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取事件对象
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="id"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("event")]
|
|
|
+ public async Task<EventCategoryDto> GetEventCategory(string id)
|
|
|
+ {
|
|
|
+ var model = await _eventCategoryRepository.GetAsync(id, HttpContext.RequestAborted);
|
|
|
+ if (model == null)
|
|
|
+ throw UserFriendlyException.SameMessage("无效数据");
|
|
|
+ return _mapper.Map<EventCategoryDto>(model);
|
|
|
+ }
|
|
|
|
|
|
#endregion
|
|
|
#endregion
|