123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- using Microsoft.AspNetCore.Authorization;
- using Microsoft.AspNetCore.Http;
- using Microsoft.AspNetCore.Mvc;
- using MTWorkHR.Application.Filters;
- using MTWorkHR.Application.Identity;
- using MTWorkHR.Application.Models;
- using MTWorkHR.Application.Services.Interfaces;
- using MTWorkHR.Identity.Services;
- namespace MTWorkHR.API.Controllers
- {
- [Route("api/[controller]")]
- [ApiController]
- [AppAuthorize]
- public class OrderRequestController : ControllerBase
- {
- private readonly IOrderRequestService _LeaveRequestService;
- public OrderRequestController(IOrderRequestService UserLeaveRequestService)
- {
- this._LeaveRequestService = UserLeaveRequestService;
- }
- [HttpGet("GetAll")]
- [ProducesResponseType(StatusCodes.Status200OK)]
- public async Task<ActionResult<List<OrderRequestDto>>> GetAll([FromQuery] PagingInputDto pagingInput)
- {
- return Ok(await _LeaveRequestService.GetAll(pagingInput));
- }
- [HttpGet("Get")]
- [ProducesResponseType(StatusCodes.Status200OK)]
- public async Task<ActionResult<OrderRequestDto>> Get(long OrderRequestId)
- {
- return Ok(await _LeaveRequestService.GetById(OrderRequestId));
- }
- [HttpPost("Create")]
- [ProducesResponseType(StatusCodes.Status200OK)]
- public async Task<ActionResult<OrderRequestDto>> Create([FromBody] OrderRequestDto input)
- {
- return await _LeaveRequestService.Create(input);
- }
- [HttpPost("Update")]
- [ProducesResponseType(StatusCodes.Status200OK)]
- public async Task Update([FromBody] OrderRequestDto input)
- {
- await _LeaveRequestService.Update(input);
- }
- [HttpPost("Delete")]
- [ProducesResponseType(StatusCodes.Status200OK)]
- public async Task Delete(long id)
- {
- await _LeaveRequestService.Delete(id);
- }
- [HttpPost("ChangeStatus")]
- [ProducesResponseType(StatusCodes.Status200OK)]
- public async Task ChangeStatus(long id, int statusId)
- {
- await _LeaveRequestService.ChangeStatus(id, statusId);
- }
- }
- }
|