OrderAllocationController.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using Microsoft.AspNetCore.Authorization;
  2. using Microsoft.AspNetCore.Http;
  3. using Microsoft.AspNetCore.Mvc;
  4. using MTWorkHR.Application.Filters;
  5. using MTWorkHR.Application.Identity;
  6. using MTWorkHR.Application.Models;
  7. using MTWorkHR.Application.Services.Interfaces;
  8. using MTWorkHR.Identity.Services;
  9. namespace MTWorkHR.API.Controllers
  10. {
  11. [Route("api/[controller]")]
  12. [ApiController]
  13. [AppAuthorize]
  14. public class OrderAllocationController : ControllerBase
  15. {
  16. private readonly IOrderAllocationService _OrderAllocationService;
  17. public OrderAllocationController(IOrderAllocationService UserOrderAllocationService)
  18. {
  19. this._OrderAllocationService = UserOrderAllocationService;
  20. }
  21. [HttpGet("GetAll")]
  22. [ProducesResponseType(StatusCodes.Status200OK)]
  23. public async Task<ActionResult<List<OrderAllocationDto>>> GetAll([FromQuery] PagingInputDto pagingInput)
  24. {
  25. return Ok(await _OrderAllocationService.GetAll(pagingInput));
  26. }
  27. [HttpGet("Get")]
  28. [ProducesResponseType(StatusCodes.Status200OK)]
  29. public async Task<ActionResult<OrderAllocationDto>> Get(long OrderAllocationId)
  30. {
  31. return Ok(await _OrderAllocationService.GetById(OrderAllocationId));
  32. }
  33. [HttpPost("Create")]
  34. [ProducesResponseType(StatusCodes.Status200OK)]
  35. public async Task<ActionResult<OrderAllocationDto>> Create([FromBody] OrderAllocationDto input)
  36. {
  37. return await _OrderAllocationService.Create(input);
  38. }
  39. [HttpPost("Update")]
  40. [ProducesResponseType(StatusCodes.Status200OK)]
  41. public async Task Update([FromBody] OrderAllocationDto input)
  42. {
  43. await _OrderAllocationService.Update(input);
  44. }
  45. [HttpPost("Delete")]
  46. [ProducesResponseType(StatusCodes.Status200OK)]
  47. public async Task Delete(long id)
  48. {
  49. await _OrderAllocationService.Delete(id);
  50. }
  51. }
  52. }