OrderAllocationController.cs 1.9 KB

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