12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- 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;
- 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<ActionResult<List<CompanyDto>>> GetAll([FromQuery] PagingInputDto pagingInput)
- {
- return Ok( await _companyService.GetAll(pagingInput));
- }
- [HttpGet("Get")]
- public async Task<ActionResult<CompanyDto>> Get(long CompanyId)
- {
- return Ok(await _companyService.GetById(CompanyId));
- }
- [HttpPost("Create")]
- [ProducesResponseType(StatusCodes.Status200OK)]
- [Consumes("multipart/form-data")]
- public async Task<ActionResult<CompanyDto>> Create([FromForm] CompanyDto input)
- {
- return await _companyService.Create(input);
- }
- [HttpPost("Update")]
- [ProducesResponseType(StatusCodes.Status200OK)]
- public async Task Update([FromBody] CompanyDto input)
- {
- await _companyService.Update(input);
- }
- [HttpPost("Delete")]
- [ProducesResponseType(StatusCodes.Status200OK)]
- public async Task Delete(long id)
- {
- await _companyService.Delete(id);
- }
-
- }
- }
|