12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- using Microsoft.AspNetCore.Authorization;
- using Microsoft.AspNetCore.Http;
- using Microsoft.AspNetCore.Mvc;
- using MTWorkHR.Application.Identity;
- using MTWorkHR.Application.Models;
- using MTWorkHR.Identity.Services;
- namespace MTWorkHR.API.Controllers
- {
- [Route("api/[controller]")]
- [ApiController]
- public class UserController : ControllerBase
- {
- private readonly IUserService _userService;
- public UserController(IUserService userService)
- {
- this._userService = userService;
- }
- [HttpGet("GetAll")]
- public async Task<ActionResult<List<UserDto>>> GetAll()
- {
- return Ok( await _userService.GetAll());
- }
- [HttpGet("Get")]
- public async Task<ActionResult<UserDto>> Get(string userId)
- {
- return Ok(await _userService.GetById(userId));
- }
- [HttpPost("Create")]
- [ProducesResponseType(StatusCodes.Status200OK)]
- public async Task<ActionResult<UserDto>> Create([FromBody] UserDto input)
- {
- return await _userService.Create(input);
- }
- [HttpPost("Update")]
- [ProducesResponseType(StatusCodes.Status200OK)]
- public async Task Update([FromBody] 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);
- }
- [HttpPost("ForgetPassword")]
- [ProducesResponseType(StatusCodes.Status200OK)]
- public async Task ForgetPassword(string input)
- {
- await _userService.ForgetPassword(input);
- }
- }
- }
|