AdminOrganizationController.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using System.Collections.Generic;
  2. using System.Threading.Tasks;
  3. using GxPress.Common.Page;
  4. using GxPress.Repository.Interface.Organization;
  5. using GxPress.Result.Organization;
  6. using Microsoft.AspNetCore.Authorization;
  7. using Microsoft.AspNetCore.Mvc;
  8. namespace GxPress.Api.AdminControllers
  9. {
  10. [Route("api/admin/organization")]
  11. [ApiController]
  12. [Authorize]
  13. public class AdminOrganizationController : Controller
  14. {
  15. private readonly IOrganizationRepository repository;
  16. public AdminOrganizationController(IOrganizationRepository repository)
  17. {
  18. this.repository = repository;
  19. }
  20. /// <summary>
  21. /// 机构列表
  22. /// </summary>
  23. /// <param name="request"></param>
  24. /// <returns></returns>
  25. [HttpPost]
  26. public async Task<PagedList<Entity.tede2.Organization.Organization>> GetAllAsync(OrganizationListRequest request)
  27. {
  28. return await repository.GetAllAsync(request);
  29. }
  30. /// <summary>
  31. /// 修改
  32. /// </summary>
  33. /// <param name="request"></param>
  34. /// <returns></returns>
  35. [HttpPut]
  36. public async Task<bool> UpdateAsync(OrganizationUpdateRequest request)
  37. {
  38. return await repository.UpdateAsync(request);
  39. }
  40. /// <summary>
  41. /// 删除
  42. /// </summary>
  43. /// <param name="ids"></param>
  44. /// <returns></returns>
  45. [HttpDelete]
  46. public async Task<bool> DeleteAsync(List<int> ids)
  47. {
  48. return await repository.DeleteAsync(ids);
  49. }
  50. /// <summary>
  51. /// 修改
  52. /// </summary>
  53. /// <param name="request"></param>
  54. /// <returns></returns>
  55. [HttpPut("update")]
  56. public async Task<bool> UpdateIsDisableAsync(OrganizationUpdateDisableRequest request)
  57. {
  58. return await repository.UpdateIsDisableAsync(request);
  59. }
  60. /// <summary>
  61. /// 添加
  62. /// /// </summary>
  63. /// <param name="model"></param>
  64. /// <returns></returns>
  65. [HttpPost("add")]
  66. public async Task<bool> InsertAsync(Entity.tede2.Organization.Organization model)
  67. {
  68. return await repository.InsertAsync(model);
  69. }
  70. }
  71. }