MeetingController.cs 1.9 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 MeetingController : ControllerBase
  15. {
  16. private readonly IMeetingService _MeetingService;
  17. public MeetingController(IMeetingService UserMeetingService)
  18. {
  19. this._MeetingService = UserMeetingService;
  20. }
  21. [HttpGet("GetAll")]
  22. [ProducesResponseType(StatusCodes.Status200OK)]
  23. public async Task<ActionResult<List<MeetingDto>>> GetAll([FromQuery] PagingInputDto pagingInput)
  24. {
  25. return Ok(await _MeetingService.GetAll(pagingInput));
  26. }
  27. [HttpGet("Get")]
  28. [ProducesResponseType(StatusCodes.Status200OK)]
  29. public async Task<ActionResult<MeetingDto>> Get(long MeetingId)
  30. {
  31. return Ok(await _MeetingService.GetById(MeetingId));
  32. }
  33. [HttpPost("Create")]
  34. [ProducesResponseType(StatusCodes.Status200OK)]
  35. public async Task<ActionResult<MeetingDto>> Create([FromBody] MeetingDto input)
  36. {
  37. return await _MeetingService.Create(input);
  38. }
  39. [HttpPost("Update")]
  40. [ProducesResponseType(StatusCodes.Status200OK)]
  41. public async Task<ActionResult<MeetingDto>> Update([FromBody] MeetingDto input)
  42. {
  43. return await _MeetingService.Update(input);
  44. }
  45. [HttpDelete("Delete")]
  46. [ProducesResponseType(StatusCodes.Status200OK)]
  47. public async Task Delete([FromQuery]long id)
  48. {
  49. await _MeetingService.Delete(id);
  50. }
  51. }
  52. }