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 ProjectController : ControllerBase { private readonly IProjectService _ProjectService; public ProjectController(IProjectService UserProjectService) { this._ProjectService = UserProjectService; } [HttpGet("GetAll")] [ProducesResponseType(StatusCodes.Status200OK)] public async Task>> GetAll([FromQuery] PagingInputDto pagingInput) { return Ok(await _ProjectService.GetAll(pagingInput)); } [HttpGet("Get")] [ProducesResponseType(StatusCodes.Status200OK)] // [AppAuthorize(Permissions = "Project")] public async Task> Get(long ProjectId) { return Ok(await _ProjectService.GetById(ProjectId)); } [HttpPost("Create")] [ProducesResponseType(StatusCodes.Status200OK)] // [AppAuthorize(Permissions = "Project.Create")] public async Task> Create([FromBody] ProjectDto input) { return await _ProjectService.Create(input); } [HttpPost("Update")] [ProducesResponseType(StatusCodes.Status200OK)] // [AppAuthorize(Permissions = "Project.Update")] public async Task Update([FromBody] ProjectDto input) { await _ProjectService.Update(input); } [HttpDelete("Delete")] [ProducesResponseType(StatusCodes.Status200OK)] // [AppAuthorize(Permissions = "Project.Delete")] public async Task Delete([FromQuery] long id) { await _ProjectService.Delete(id); } } }