* Managed API to handle User maintenance
* Managed Users view in application
This commit is contained in:
@@ -7,14 +7,14 @@ namespace OrdersManagementDataModel.Services;
|
||||
|
||||
public class RoleService(OrdersManagementDbContext context, IMapper mapper) : IRoleService
|
||||
{
|
||||
public async Task<IEnumerable<RoleDto>> GetRoles()
|
||||
public async Task<IEnumerable<RoleDto>> GetAll()
|
||||
{
|
||||
IList<RoleDto> roles = await context.Roles.Select(x => mapper.Map<RoleDto>(x)).ToListAsync();
|
||||
|
||||
return roles;
|
||||
}
|
||||
|
||||
public async Task<RoleDto?> GetRoleById(Guid id)
|
||||
public async Task<RoleDto?> GetById(Guid id)
|
||||
{
|
||||
RoleDto? role = await context.Roles.Where(x => x.RowPointer == id)
|
||||
.Select(x => mapper.Map<RoleDto>(x)).FirstOrDefaultAsync();
|
||||
@@ -22,7 +22,7 @@ public class RoleService(OrdersManagementDbContext context, IMapper mapper) : IR
|
||||
return role;
|
||||
}
|
||||
|
||||
public async Task<RoleDto?> GetRoleByName(string name)
|
||||
public async Task<RoleDto?> GetByName(string name)
|
||||
{
|
||||
RoleDto? role = await context.Roles.Where(x => x.Name == name)
|
||||
.Select(x => mapper.Map<RoleDto>(x)).FirstOrDefaultAsync();
|
||||
@@ -30,7 +30,7 @@ public class RoleService(OrdersManagementDbContext context, IMapper mapper) : IR
|
||||
return role;
|
||||
}
|
||||
|
||||
public async Task<int> AddRole(RoleDto roleDto)
|
||||
public async Task<int> Add(RoleDto roleDto)
|
||||
{
|
||||
Role role = new Role
|
||||
{
|
||||
@@ -42,7 +42,7 @@ public class RoleService(OrdersManagementDbContext context, IMapper mapper) : IR
|
||||
return await context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public async Task<int> DeleteRole(Guid id)
|
||||
public async Task<int> Delete(Guid id)
|
||||
{
|
||||
Role? role = await context.Roles.Where(x => x.RowPointer == id).FirstOrDefaultAsync() ?? null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user