TeamController.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 TeamController : ControllerBase
  13. {
  14. private readonly ITeamService _TeamService;
  15. public TeamController(ITeamService UserTeamService)
  16. {
  17. this._TeamService = UserTeamService;
  18. }
  19. [HttpGet("GetAll")]
  20. [ProducesResponseType(StatusCodes.Status200OK)]
  21. public async Task<ActionResult<List<TeamDto>>> GetAll([FromQuery] PagingInputDto pagingInput)
  22. {
  23. return Ok(await _TeamService.GetAll(pagingInput));
  24. }
  25. [HttpGet("Get")]
  26. [ProducesResponseType(StatusCodes.Status200OK)]
  27. public async Task<ActionResult<TeamDto>> Get(long TeamId)
  28. {
  29. return Ok(await _TeamService.GetById(TeamId));
  30. }
  31. [HttpPost("Create")]
  32. [ProducesResponseType(StatusCodes.Status200OK)]
  33. public async Task<ActionResult<TeamDto>> Create([FromBody] TeamDto input)
  34. {
  35. return await _TeamService.Create(input);
  36. }
  37. [HttpPost("Update")]
  38. [ProducesResponseType(StatusCodes.Status200OK)]
  39. public async Task Update([FromBody] TeamDto input)
  40. {
  41. await _TeamService.Update(input);
  42. }
  43. [HttpPost("Delete")]
  44. [ProducesResponseType(StatusCodes.Status200OK)]
  45. public async Task Delete(long id)
  46. {
  47. await _TeamService.Delete(id);
  48. }
  49. [HttpPost("AssignAdminManager")]
  50. [ProducesResponseType(StatusCodes.Status200OK)]
  51. public async Task<bool> AssignAdminManager([FromBody] TeamUserDto teamUser)
  52. {
  53. return await _TeamService.AssignAdminManager(teamUser);
  54. }
  55. }
  56. }