AirCompanyController.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using Microsoft.AspNetCore.Mvc;
  2. using SMP.Model;
  3. using SMP.Service;
  4. using SMP.Service.ProviderServices.Dto;
  5. using XYY.Common.Standard;
  6. using XYY.Core.Standard.Mvc;
  7. namespace SMP.Api.Base.Controllers
  8. {
  9. [ApiController]
  10. [Route("[controller]/[action]")]
  11. public class AirCompanyController : ControllerBase
  12. {
  13. public AirCompanyController(ISysAirCompanyService airCompanyService)
  14. {
  15. AirCompanyService = airCompanyService;
  16. }
  17. public ISysAirCompanyService AirCompanyService { get; }
  18. [HttpPost]
  19. public async Task<PageResult<Sys_AirCompany>> QueryPage([FromBody] QueryModel model)
  20. {
  21. var pageResult = await AirCompanyService.QueryAirCompany(model);
  22. return pageResult;
  23. }
  24. [HttpGet]
  25. public async Task<IEnumerable<Sys_AirCompany>> GetAllAirCompany()
  26. {
  27. return (await AirCompanyService.GetAirCompanyList()).OrderBy(x => x.Name).ToList();
  28. }
  29. [HttpPost]
  30. public async Task<ApiJsonModel> Add([FromBody] Sys_AirCompany ServiceProvider)
  31. {
  32. await AirCompanyService.InsertAirCompany(ServiceProvider);
  33. return ApiJsonModel.OK();
  34. }
  35. [HttpPost]
  36. public async Task<ApiJsonModel> Update([FromBody] Sys_AirCompany ServiceProvider)
  37. {
  38. await AirCompanyService.UpdateAirCompany(ServiceProvider);
  39. return ApiJsonModel.OK();
  40. }
  41. [HttpPost]
  42. public async Task<ApiJsonModel> Delete([FromBody] Sys_AirCompany ServiceProvider)
  43. {
  44. await AirCompanyService.DeleteAirCompany(ServiceProvider);
  45. return ApiJsonModel.OK();
  46. }
  47. }
  48. }