AdminAppStartPageController.cs 2.2 KB

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