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; using MTWorkHR.Application.Services.Interfaces; namespace MTWorkHR.API.Controllers { [Route("api/[controller]")] [ApiController] [AppAuthorize] public class CompanyController : ControllerBase { private readonly ICompanyService _companyService; public CompanyController(ICompanyService CompanyService) { this._companyService = CompanyService; } [HttpGet("GetAll")] public async Task>> GetAll([FromQuery] PagingInputDto pagingInput) { return Ok( await _companyService.GetAll(pagingInput)); } [HttpGet("Get")] public async Task> Get() { return Ok(await _companyService.GetById()); } [HttpGet("GetById")] public async Task> GetById(long companyId) { return Ok(await _companyService.GetById(companyId)); } [HttpPost("Create")] [ProducesResponseType(StatusCodes.Status200OK)] [Consumes("multipart/form-data")] [AllowAnonymous] public async Task> Create([FromForm] CompanyDto input) { return await _companyService.Create(input); } [HttpPost("Update")] [ProducesResponseType(StatusCodes.Status200OK)] [Consumes("multipart/form-data")] public async Task> Update([FromForm] CompanyDto input) { return await _companyService.Update(input); } [HttpDelete("Delete")] [ProducesResponseType(StatusCodes.Status200OK)] public async Task Delete([FromQuery] long id) { await _companyService.Delete(id); } } }