Felhasználó és szabály törlésének befejezése
This commit is contained in:
@@ -19,16 +19,13 @@ using Microsoft.AspNetCore.Identity;
|
||||
|
||||
namespace WorkFlowCheck.BL.Services
|
||||
{
|
||||
public class UserService : IUserService
|
||||
public class UserService : BaseService, IUserService
|
||||
{
|
||||
private AppDbContext _dbContext;
|
||||
private IMapper _mapper;
|
||||
private IConfiguration _configuration;
|
||||
|
||||
public UserService(AppDbContext dbContext, IMapper mapper, IConfiguration configuration)
|
||||
public UserService(AppDbContext dbContext, IMapper mapper, IConfiguration configuration) : base(dbContext, mapper)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_mapper = mapper;
|
||||
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
@@ -76,6 +73,10 @@ namespace WorkFlowCheck.BL.Services
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
public async Task<bool> DeleteUserAsync(int id)
|
||||
{
|
||||
return await DeleteEntityByIdAsync<User>(id);
|
||||
}
|
||||
public async Task<UserDTO> Authenticate(string userName, string password)
|
||||
{
|
||||
var retVal = new UserDTO() { RoleDTO = new List<RoleDTO>() };
|
||||
@@ -199,12 +200,12 @@ namespace WorkFlowCheck.BL.Services
|
||||
user.LastName = userDTO.LastName;
|
||||
user.Email = userDTO.Email;
|
||||
user.NFCActive = userDTO.NFCActive;
|
||||
user.NFCCode = userDTO.NFCCode;
|
||||
user.NFCCode = userDTO.NFCCode;
|
||||
user.JwtToken = "";
|
||||
user.Token2FA = "";
|
||||
user.IsDeleted = false;
|
||||
user.Active = userDTO.Active;
|
||||
|
||||
|
||||
|
||||
user.PasswordHash = PasswordHasher.HashPassword(userDTO.Password);
|
||||
|
||||
@@ -275,6 +276,10 @@ namespace WorkFlowCheck.BL.Services
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
public async Task<bool> DeleteRoleAsync(int id)
|
||||
{
|
||||
return await DeleteEntityByIdAsync<Role>(id);
|
||||
}
|
||||
public async Task<RoleDTO> UpdateRoleAsync(RoleDTO roleDTO)
|
||||
{
|
||||
var retVal = new RoleDTO();
|
||||
@@ -291,6 +296,8 @@ namespace WorkFlowCheck.BL.Services
|
||||
role.IsAdmin = roleDTO.IsAdmin;
|
||||
role.CanDownloadAPK = roleDTO.CanDownloadAPK;
|
||||
role.CanEnableBlocked = roleDTO.CanEnableBlocked;
|
||||
role.CanUseWebAdmin = roleDTO.CanUseWebAdmin;
|
||||
role.CanUseMobilApp = roleDTO.CanUseMobilApp;
|
||||
_dbContext.Roles.Add(role);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
||||
@@ -310,6 +317,8 @@ namespace WorkFlowCheck.BL.Services
|
||||
role.IsAdmin = roleDTO.IsAdmin;
|
||||
role.CanDownloadAPK = roleDTO.CanDownloadAPK;
|
||||
role.CanEnableBlocked = roleDTO.CanEnableBlocked;
|
||||
role.CanUseWebAdmin = roleDTO.CanUseWebAdmin;
|
||||
role.CanUseMobilApp = roleDTO.CanUseMobilApp;
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
||||
retVal = _mapper.Map<RoleDTO>(role);
|
||||
|
||||
Reference in New Issue
Block a user