Initial version
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\EonaCat.gRPC.Repository\EonaCat.gRPC.Repository.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,8 @@
|
||||
using EonaCat.gRPC.Core.Interfaces.Services;
|
||||
|
||||
namespace EonaCat.gRPC.Service;
|
||||
|
||||
public class GreeterService : IGreeterService
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using EonaCat.gRPC.Core.Entities;
|
||||
using EonaCat.gRPC.Core.Interfaces.Repositories;
|
||||
using EonaCat.gRPC.Core.Interfaces.Services;
|
||||
|
||||
namespace EonaCat.gRPC.Service;
|
||||
|
||||
public class UserService : IUserService
|
||||
{
|
||||
private readonly IUserRepository _userRepository;
|
||||
|
||||
public UserService(IUserRepository userRepository)
|
||||
{
|
||||
_userRepository = userRepository;
|
||||
}
|
||||
|
||||
public async Task<long> CreateUser(UserEntity user)
|
||||
{
|
||||
await _userRepository.AddAsync(user);
|
||||
await _userRepository.SaveChangesAsync();
|
||||
return user.Id;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<UserEntity>> GetAsync()
|
||||
{
|
||||
var users = await _userRepository.ListAsync();
|
||||
return users;
|
||||
}
|
||||
|
||||
public async Task<UserEntity> GetAsync(long id)
|
||||
{
|
||||
var user = await _userRepository.GetAsync(id);
|
||||
return user;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user