You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.0 KiB
38 lines
1.0 KiB
using Infrastructure;
|
|
using Infrastructure.Repositories;
|
|
using Server.Dto.Response;
|
|
using Server.IServices;
|
|
using AutoMapper;
|
|
using Shared;
|
|
|
|
namespace Server.Services;
|
|
|
|
public class UsersService : IUsersService
|
|
{
|
|
private readonly OptifitDbContext _context;
|
|
private readonly UserRepository _userRepository;
|
|
private readonly IMapper _mapper;
|
|
|
|
public UsersService(OptifitDbContext context, UserRepository userRepository, IMapper mapper)
|
|
{
|
|
_context = context;
|
|
_userRepository = userRepository;
|
|
_mapper = mapper;
|
|
}
|
|
|
|
public async Task<ResponseUserDto?> GetUserById(string id)
|
|
{
|
|
var userEntity = await _userRepository.GetByIdAsync(id);
|
|
if (userEntity == null)
|
|
{
|
|
return null;
|
|
}
|
|
var userDto = _mapper.Map<ResponseUserDto>(userEntity);
|
|
return userDto;
|
|
}
|
|
|
|
public Task<PaginatedResult<ResponseUserDto>> GetUsers(int page, int size, bool ascending = true)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
} |