123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- 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.Identity.Services;
- namespace MTWorkHR.API.Controllers
- {
- [Route("api/[controller]")]
- [ApiController]
- [AppAuthorize]
- public class UserController : ControllerBase
- {
- private readonly IUserService _userService;
- public UserController(IUserService userService)
- {
- this._userService = userService;
- }
- [HttpGet("GetAll")]
- public async Task<ActionResult<List<UserAllDto>>> GetAll([FromQuery] UserPagingInputDto pagingInput)
- {
- return Ok( await _userService.GetAll(pagingInput));
- }
- [HttpGet("GetAllCompanyEmployees")]
- public async Task<ActionResult<List<UserDto>>> GetAllCompanyEmployees()
- {
- return Ok(await _userService.GetAllCompanyEmployees());
- }
- [HttpGet("Get")]
- public async Task<ActionResult<UserDto>> Get(string userId)
- {
- return Ok(await _userService.GetById(userId));
- }
- [HttpPost("Create")]
- [ProducesResponseType(StatusCodes.Status200OK)]
- [Consumes("multipart/form-data")]
- public async Task<ActionResult<UserDto>> Create([FromForm] UserDto input)
- {
- return await _userService.Create(input);
- }
- [HttpPost("Update")]
- [Consumes("multipart/form-data")]
- [ProducesResponseType(StatusCodes.Status200OK)]
- public async Task Update([FromForm] UserDto input)
- {
- await _userService.Update(input);
- }
- [HttpPost("Delete")]
- [ProducesResponseType(StatusCodes.Status200OK)]
- public async Task Delete(string id)
- {
- await _userService.Delete(id);
- }
- [HttpPost("ResetPassword")]
- [ProducesResponseType(StatusCodes.Status200OK)]
- public async Task<bool> ResetPassword([FromBody] ResetPasswordDto input)
- {
- return await _userService.ResetPassword(input);
- }
-
- }
- }
|