Create models and Clean Arch boilerplate
This commit is contained in:
parent
3926db5446
commit
872dc1e263
21 changed files with 576 additions and 27 deletions
|
@ -1,6 +0,0 @@
|
|||
namespace CSR.Application;
|
||||
|
||||
public class Class1
|
||||
{
|
||||
|
||||
}
|
13
CSR.Application/Interfaces/IRoleRepository.cs
Normal file
13
CSR.Application/Interfaces/IRoleRepository.cs
Normal file
|
@ -0,0 +1,13 @@
|
|||
namespace CSR.Application.Interfaces;
|
||||
|
||||
using CSR.Domain.Entities;
|
||||
|
||||
public interface IRoleRepository
|
||||
{
|
||||
Task<Role?> GetByIdAsync(int id);
|
||||
// Task<Role?> GetByNameAsync(string name);
|
||||
// Task<IEnumerable<Role>> GetAllAsync();
|
||||
Task AddAsync(Role role);
|
||||
// Task UpdateAsync(Role role);
|
||||
Task DeleteAsync(int id);
|
||||
}
|
14
CSR.Application/Interfaces/IUserRepository.cs
Normal file
14
CSR.Application/Interfaces/IUserRepository.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
namespace CSR.Application.Interfaces;
|
||||
|
||||
using CSR.Domain.Entities;
|
||||
|
||||
public interface IUserRepository
|
||||
{
|
||||
Task<User?> GetByIdAsync(int id);
|
||||
// Task<User?> GetByEmailAsync(string email);
|
||||
// Task<User?> GetByUsernameAsync(string username);
|
||||
// Task<IEnumerable<User>> GetAllAsync();
|
||||
Task AddAsync(User user);
|
||||
Task UpdateAsync(User user);
|
||||
Task DeleteAsync(int id);
|
||||
}
|
8
CSR.Application/Interfaces/IUserService.cs
Normal file
8
CSR.Application/Interfaces/IUserService.cs
Normal file
|
@ -0,0 +1,8 @@
|
|||
namespace CSR.Application.Interfaces;
|
||||
|
||||
public interface IUserService
|
||||
{
|
||||
public record CreateUserResult(Domain.Entities.User? User, string? ErrorMessage);
|
||||
|
||||
public void CreateUser(string username, string email, string password, bool isAdmin = false);
|
||||
}
|
14
CSR.Application/Services/UserService.cs
Normal file
14
CSR.Application/Services/UserService.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
namespace CSR.Application.Services;
|
||||
|
||||
using CSR.Application.Interfaces;
|
||||
using CSR.Domain.Entities;
|
||||
|
||||
public class UserService(IUserRepository userRepository) : IUserService
|
||||
{
|
||||
private readonly IUserRepository _userRepository = userRepository;
|
||||
|
||||
public void CreateNewUser(string username, string email, string password, bool isAdmin = false)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue