AdminAppStartPageController.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using System.Collections.Generic;
  2. using System.Threading.Tasks;
  3. using GxPress.Auth;
  4. using GxPress.Repository.Interface.AppStartPage;
  5. using GxPress.Request.AppStartPage;
  6. using Microsoft.AspNetCore.Authorization;
  7. using Microsoft.AspNetCore.Mvc;
  8. namespace GxPress.Api.AdminControllers
  9. {
  10. /// <summary>
  11. /// app启动页管理
  12. /// </summary>
  13. [Route("api/admin/app-start-page")]
  14. [ApiController]
  15. [Authorize]
  16. public class AdminAppStartPageController : Controller
  17. {
  18. private readonly ILoginContext _loginContext;
  19. private readonly IAppStartPageRepository appStartPageRepository;
  20. public AdminAppStartPageController(IAppStartPageRepository appStartPageRepository, ILoginContext _loginContext)
  21. {
  22. this.appStartPageRepository = appStartPageRepository;
  23. this._loginContext = _loginContext;
  24. }
  25. /// <summary>
  26. /// 查询
  27. /// </summary>
  28. /// <returns></returns>
  29. [HttpGet("list")]
  30. public async Task<IEnumerable<Entity.tede2.AppStartPage.AppStartPage>> GetAllAsync()
  31. {
  32. return await appStartPageRepository.GetAllAsync();
  33. }
  34. /// <summary>
  35. /// 删除
  36. /// </summary>
  37. /// <param name="id"></param>
  38. /// <returns></returns>
  39. [HttpDelete("{id}")]
  40. public async Task<bool> DeleteAsync(int id)
  41. {
  42. return await appStartPageRepository.DeleteAsync(id);
  43. }
  44. /// <summary>
  45. /// 修改
  46. /// </summary>
  47. /// <param name="model"></param>
  48. /// <returns></returns>
  49. [HttpPut("")]
  50. public async Task<bool> UpdateAsync(AppStartPageUpdateRequest request)
  51. {
  52. return await appStartPageRepository.UpdateAsync(request);
  53. }
  54. /// <summary>
  55. /// 添加
  56. /// </summary>
  57. /// <param name="model"></param>
  58. /// <returns></returns>
  59. [HttpPost]
  60. public async Task<bool> InsertAsync(Entity.tede2.AppStartPage.AppStartPage model)
  61. {
  62. model.Creator = _loginContext.Name;
  63. model.AdminId = _loginContext.AccountId;
  64. return await appStartPageRepository.InsertAsync(model);
  65. }
  66. }
  67. }