| @@ -1,4 +1,5 @@ | |||
| using System; | |||
| using Diligent.WebAPI.Contracts.DTOs.User; | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| @@ -13,6 +14,10 @@ namespace Diligent.WebAPI.Business.MappingProfiles | |||
| #region DTO to Model | |||
| CreateMap<CreateUserRequestDto, User>(); | |||
| #endregion | |||
| #region Model to DTO | |||
| CreateMap<User, UserResponseDTO>(); | |||
| #endregion | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,18 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using System.Threading.Tasks; | |||
| namespace Diligent.WebAPI.Contracts.DTOs.User | |||
| { | |||
| public class UserResponseDTO | |||
| { | |||
| public int Id { get; set; } | |||
| public string FirstName { get; set; } | |||
| public string LastName { get; set; } | |||
| public string Email { get; set; } | |||
| //public string CVLink { get; set; } | |||
| //public string Position { get; set; } | |||
| } | |||
| } | |||
| @@ -1,4 +1,7 @@ | |||
| namespace Diligent.WebAPI.Host.Controllers.V1 | |||
| using Diligent.WebAPI.Contracts.DTOs.User; | |||
| using Diligent.WebAPI.Data.Entities; | |||
| namespace Diligent.WebAPI.Host.Controllers.V1 | |||
| { | |||
| [ApiVersion("1.0")] | |||
| [Route("v{version:apiVersion}/users")] | |||
| @@ -6,19 +9,21 @@ | |||
| public class UsersController : ControllerBase | |||
| { | |||
| private readonly IUserService _userService; | |||
| private readonly IMapper _mapper; | |||
| private readonly IEmailer _emailer; | |||
| public UsersController(IUserService userService, IEmailer emailer) | |||
| public UsersController(IUserService userService, IEmailer emailer, IMapper mapper) | |||
| { | |||
| _userService = userService; | |||
| _mapper = mapper; | |||
| _emailer = emailer; | |||
| } | |||
| [Authorize] | |||
| [HttpGet] | |||
| public async Task<IActionResult> GetAll() | |||
| { | |||
| return Ok("Hello from protected route"); | |||
| return Ok(_mapper.Map<IEnumerable<User?>, IEnumerable<UserResponseDTO>>(await _userService.GetAll())); | |||
| } | |||
| [HttpGet("ForgotPassword")] | |||
| @@ -1,6 +1,6 @@ | |||
| { | |||
| "ConnectionStrings": { | |||
| "WebApi": "Server=192.168.88.105;Database=HRCenter;User Id=hrcentar;Password=" | |||
| "WebApi": "Server=192.168.88.105;Database=HRCenter;User Id=hrcentar;Password=;" | |||
| }, | |||
| "Authorization": { | |||
| "JwtExpiredTime": "5", | |||
| @@ -1,6 +1,6 @@ | |||
| { | |||
| "ConnectionStrings": { | |||
| "WebApi": "Server=192.168.88.105;Database=HRCenter;User Id=hrcentar;Password=" | |||
| "WebApi": "Server=192.168.88.105;Database=HRCenter;User Id=hrcentar;Password=;" | |||
| }, | |||
| "Authorization": { | |||
| "JwtExpiredTime": "5", | |||