UserTaskController.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 UserTaskController : ControllerBase
  13. {
  14. private readonly IUserTaskService _userTaskService;
  15. public UserTaskController(IUserTaskService UserUserTaskService)
  16. {
  17. this._userTaskService = UserUserTaskService;
  18. }
  19. [HttpGet("GetAll")]
  20. public async Task<ActionResult<List<UserTaskDto>>> GetAll([FromQuery]PagingInputDto pagingInput)
  21. {
  22. return Ok(await _userTaskService.GetAll(pagingInput));
  23. }
  24. [HttpGet("Get")]
  25. public async Task<ActionResult<UserTaskDto>> Get(long UserTaskId)
  26. {
  27. return Ok(await _userTaskService.GetById(UserTaskId));
  28. }
  29. [HttpPost("Create")]
  30. [ProducesResponseType(StatusCodes.Status200OK)]
  31. public async Task<ActionResult<UserTaskDto>> Create([FromBody] UserTaskDto input)
  32. {
  33. return await _userTaskService.Create(input);
  34. }
  35. [HttpPost("Update")]
  36. [ProducesResponseType(StatusCodes.Status200OK)]
  37. public async Task Update([FromBody] UserTaskDto input)
  38. {
  39. await _userTaskService.Update(input);
  40. }
  41. [HttpPost("Delete")]
  42. [ProducesResponseType(StatusCodes.Status200OK)]
  43. public async Task Delete(long id)
  44. {
  45. await _userTaskService.Delete(id);
  46. }
  47. }
  48. }