Refaktorisierung der Lokalisierung und DTO-Integration
- Ersetzung von ITranslateService durch IStringLocalizer<X> für verbesserte Lokalisierung. - Aktualisierung der DTO-Klassen entsprechend der neuesten Core.DTO-Struktur. - Integration der neuen Klassen Result und DataResult aus Core.DTO für standardisierte Serviceantworten.
This commit is contained in:
@@ -2,15 +2,16 @@
|
||||
using DigitalData.UserManager.Application.DTOs.GroupOfUser;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
using DigitalData.Core.DTO;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Contracts
|
||||
{
|
||||
public interface IGroupOfUserService : ICRUDService<IGroupOfUserRepository, GroupOfUserCreateDto, GroupOfUserReadDto, GroupOfUserUpdateDto, GroupOfUser, int>
|
||||
{
|
||||
Task<IServiceMessage> DeleteAsyncByGroupUserId(int groupId, int userId);
|
||||
Task<Result> DeleteAsyncByGroupUserId(int groupId, int userId);
|
||||
|
||||
Task<IServiceResult<IEnumerable<GroupOfUserReadDto>>> ReadAllAsyncWith(bool user, bool group);
|
||||
Task<DataResult<IEnumerable<GroupOfUserReadDto>>> ReadAllAsyncWith(bool user, bool group);
|
||||
|
||||
Task<IServiceMessage> HasGroup(string username, string groupname, bool caseSensitive = true);
|
||||
Task<Result> HasGroup(string username, string groupname, bool caseSensitive = true);
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,12 @@
|
||||
using DigitalData.UserManager.Application.DTOs.Group;
|
||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.Core.DTO;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Contracts
|
||||
{
|
||||
public interface IGroupService : ICRUDService<IGroupRepository, GroupCreateDto, GroupReadDto, GroupUpdateDto, Group, int>
|
||||
{
|
||||
Task<IServiceResult<int>> CreateAsync(DirectoryGroupDto dirGroup);
|
||||
Task<DataResult<int>> CreateAsync(DirectoryGroupDto dirGroup);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using DigitalData.Core.Contracts.Application;
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.UserManager.Application.DTOs.ModuleOfUser;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
@@ -7,6 +8,6 @@ namespace DigitalData.UserManager.Application.Contracts
|
||||
{
|
||||
public interface IModuleOfUserService : ICRUDService<IModuleOfUserRepository, ModuleOfUserCreateDto, ModuleOfUserReadDto, ModuleOfUserUpdateDto, ModuleOfUser, int>
|
||||
{
|
||||
Task<IServiceMessage> DeleteAsyncByModuleUserId(int moduleId, int userId);
|
||||
Task<Result> DeleteAsyncByModuleUserId(int moduleId, int userId);
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,12 @@
|
||||
using DigitalData.UserManager.Application.DTOs.UserRep;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
using DigitalData.Core.DTO;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Contracts
|
||||
{
|
||||
public interface IUserRepService : ICRUDService<IUserRepRepository, UserRepCreateDto, UserRepReadDto, UserRepUpdateDto, UserRep, int>
|
||||
{
|
||||
Task<IServiceResult<IEnumerable<UserRepReadDto>>> ReadAllAsync(bool withUser = false, bool withRepGroup = false, bool withRightGroup = false, bool withRepUser = false, int? userId = null);
|
||||
Task<DataResult<IEnumerable<UserRepReadDto>>> ReadAllAsync(bool withUser = false, bool withRepGroup = false, bool withRightGroup = false, bool withRepUser = false, int? userId = null);
|
||||
}
|
||||
}
|
||||
@@ -2,21 +2,22 @@
|
||||
using DigitalData.UserManager.Application.DTOs.User;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
using DigitalData.Core.DTO;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Contracts
|
||||
{
|
||||
public interface IUserService : ICRUDService<IUserRepository, UserCreateDto, UserReadDto, UserUpdateDto, User, int>
|
||||
{
|
||||
Task<IServiceResult<IEnumerable<UserReadDto>>> ReadByModuleIdAsync(int moduleId);
|
||||
Task<DataResult<IEnumerable<UserReadDto>>> ReadByModuleIdAsync(int moduleId);
|
||||
|
||||
Task<IServiceResult<IEnumerable<UserReadDto>>> ReadUnassignedByModuleIdAsync(int moduleId);
|
||||
Task<DataResult<IEnumerable<UserReadDto>>> ReadUnassignedByModuleIdAsync(int moduleId);
|
||||
|
||||
Task<IServiceResult<IEnumerable<UserReadDto>>> ReadByGroupIdAsync(int groupId);
|
||||
Task<DataResult<IEnumerable<UserReadDto>>> ReadByGroupIdAsync(int groupId);
|
||||
|
||||
Task<IServiceResult<IEnumerable<UserReadDto>>> ReadUnassignedByGroupIdAsync(int groupId);
|
||||
Task<DataResult<IEnumerable<UserReadDto>>> ReadUnassignedByGroupIdAsync(int groupId);
|
||||
|
||||
Task<IServiceResult<int>> CreateAsync(UserPrincipalDto upDto);
|
||||
Task<DataResult<int>> CreateAsync(UserPrincipalDto upDto);
|
||||
|
||||
Task<IServiceResult<UserReadDto>> ReadByUsernameAsync(string username);
|
||||
Task<DataResult<UserReadDto>> ReadByUsernameAsync(string username);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
@@ -8,8 +8,10 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper" Version="13.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="7.0.16" />
|
||||
<PackageReference Include="System.DirectoryServices" Version="7.0.1" />
|
||||
<PackageReference Include="System.DirectoryServices.AccountManagement" Version="7.0.1" />
|
||||
<PackageReference Include="System.DirectoryServices.Protocols" Version="7.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -24,6 +26,9 @@
|
||||
<Reference Include="DigitalData.Core.Contracts">
|
||||
<HintPath>..\..\WebCoreModules\DigitalData.Core.Application\bin\Debug\net7.0\DigitalData.Core.Contracts.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Core.DTO">
|
||||
<HintPath>..\..\WebCoreModules\DigitalData.Core.Application\bin\Debug\net7.0\DigitalData.Core.DTO.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
12
DigitalData.UserManager.Application/Key.cs
Normal file
12
DigitalData.UserManager.Application/Key.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace DigitalData.UserManager.Application
|
||||
{
|
||||
public static class Key
|
||||
{
|
||||
public static readonly string UserNotFoundInLocalDB = "UserNotFoundInLocalDB";
|
||||
public static readonly string GroupNotFound = "GroupNotFound";
|
||||
public static readonly string GroupAlreadyExists = "GroupAlreadyExists";
|
||||
public static readonly string UserAlreadyExists = "UserAlreadyExists";
|
||||
public static readonly string UserNotFound = "UserNotFound";
|
||||
public static readonly string UnauthorizedUser = "UnauthorizedUser";
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
namespace DigitalData.UserManager.Application
|
||||
{
|
||||
public enum MessageKey
|
||||
{
|
||||
UserNotFoundInLocalDB,
|
||||
GroupNotFound,
|
||||
GroupAlreadyExists,
|
||||
UserAlreadyExists,
|
||||
UserNotFound,
|
||||
UnauthorizedUser
|
||||
}
|
||||
}
|
||||
9
DigitalData.UserManager.Application/Resource.cs
Normal file
9
DigitalData.UserManager.Application/Resource.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace DigitalData.UserManager.Application
|
||||
{
|
||||
/// <summary>
|
||||
/// Place holder class for Resource.*.resx as the resouce of IStringLocalizer.
|
||||
/// </summary>
|
||||
public class Resource
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,21 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.Core.Application;
|
||||
using DigitalData.Core.Contracts.Application;
|
||||
using DigitalData.Core.Contracts.CultureServices;
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.UserManager.Application.Contracts;
|
||||
using DigitalData.UserManager.Application.DTOs.GroupOfUser;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Services
|
||||
{
|
||||
public class GroupOfUserService : CRUDService<IGroupOfUserRepository, GroupOfUserCreateDto, GroupOfUserReadDto, GroupOfUserUpdateDto, GroupOfUser, int>, IGroupOfUserService
|
||||
{
|
||||
public GroupOfUserService(IGroupOfUserRepository repository, IKeyTranslationService translationService, IMapper mapper) : base(repository, translationService, mapper)
|
||||
public GroupOfUserService(IGroupOfUserRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, localizer, mapper)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<IServiceMessage> DeleteAsyncByGroupUserId(int groupId, int userId)
|
||||
public async Task<Result> DeleteAsyncByGroupUserId(int groupId, int userId)
|
||||
{
|
||||
var mous = await _repository.ReadByGroupUserIdAsync(groupId, userId);
|
||||
|
||||
@@ -24,10 +24,10 @@ namespace DigitalData.UserManager.Application.Services
|
||||
await _repository.DeleteAsync(mou);
|
||||
}
|
||||
|
||||
return Successful();
|
||||
return Result.Success();
|
||||
}
|
||||
|
||||
public async Task<IServiceResult<IEnumerable<GroupOfUserReadDto>>> ReadAllAsyncWith(bool user, bool group)
|
||||
public async Task<DataResult<IEnumerable<GroupOfUserReadDto>>> ReadAllAsyncWith(bool user, bool group)
|
||||
{
|
||||
IEnumerable<GroupOfUser> entities;
|
||||
|
||||
@@ -49,10 +49,10 @@ namespace DigitalData.UserManager.Application.Services
|
||||
}
|
||||
|
||||
var gouReadDtos = _mapper.MapOrThrow<IEnumerable<GroupOfUserReadDto>>(entities);
|
||||
return Successful(gouReadDtos);
|
||||
return Result.Success(gouReadDtos);
|
||||
}
|
||||
|
||||
public async Task<IServiceMessage> HasGroup(string username, string groupname, bool caseSensitive = true)
|
||||
public async Task<Result> HasGroup(string username, string groupname, bool caseSensitive = true)
|
||||
{
|
||||
var gous = await _repository.ReadAllAsyncWithGroupAndUser();
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace DigitalData.UserManager.Application.Services
|
||||
else
|
||||
gous = gous.Where(gous => gous.User?.Username.ToLower() == username.ToLower() && gous.Group?.Name?.ToLower() == groupname.ToLower());
|
||||
|
||||
return CreateMessage(gous.Any());
|
||||
return gous.Any() ? Result.Success() : Result.Fail();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +1,32 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.Core.Application;
|
||||
using DigitalData.Core.Contracts.Application;
|
||||
using DigitalData.Core.Contracts.CultureServices;
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.UserManager.Application.Contracts;
|
||||
using DigitalData.UserManager.Application.DTOs.Group;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Services
|
||||
{
|
||||
public class GroupService : CRUDService<IGroupRepository, GroupCreateDto, GroupReadDto, GroupUpdateDto, Group, int>, IGroupService
|
||||
{
|
||||
public GroupService(IGroupRepository repository, IKeyTranslationService translationService, IMapper mapper) : base(repository, translationService, mapper)
|
||||
public GroupService(IGroupRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, localizer, mapper)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<IServiceResult<int>> CreateAsync(DirectoryGroupDto adGroup)
|
||||
public async Task<DataResult<int>> CreateAsync(DirectoryGroupDto adGroup)
|
||||
{
|
||||
var group = _mapper.MapOrThrow<Group>(adGroup);
|
||||
|
||||
if (await HasEntity(group.Guid))
|
||||
return Failed<int>(MessageKey.GroupAlreadyExists.ToString());
|
||||
return Result.Fail<int>().Message(_localizer[Key.GroupAlreadyExists.ToString()]);
|
||||
|
||||
var createdGroup = await _repository.CreateAsync(group);
|
||||
if (createdGroup is null)
|
||||
return Failed<int>();
|
||||
return Result.Fail<int>();
|
||||
else
|
||||
return Successful(KeyValueOf(createdGroup));
|
||||
return Result.Success(KeyValueOf(createdGroup));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,21 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.Core.Application;
|
||||
using DigitalData.Core.Contracts.Application;
|
||||
using DigitalData.Core.Contracts.CultureServices;
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.UserManager.Application.Contracts;
|
||||
using DigitalData.UserManager.Application.DTOs.ModuleOfUser;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Services
|
||||
{
|
||||
public class ModuleOfUserService : CRUDService<IModuleOfUserRepository, ModuleOfUserCreateDto, ModuleOfUserReadDto, ModuleOfUserUpdateDto, ModuleOfUser, int>, IModuleOfUserService
|
||||
{
|
||||
public ModuleOfUserService(IModuleOfUserRepository repository, IKeyTranslationService translationService, IMapper mapper) : base(repository, translationService, mapper)
|
||||
public ModuleOfUserService(IModuleOfUserRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, localizer, mapper)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<IServiceMessage> DeleteAsyncByModuleUserId(int moduleId, int userId)
|
||||
public async Task<Result> DeleteAsyncByModuleUserId(int moduleId, int userId)
|
||||
{
|
||||
var mous = await _repository.ReadByModelUserIdAsync(moduleId, userId);
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace DigitalData.UserManager.Application.Services
|
||||
await _repository.DeleteAsync(mou);
|
||||
}
|
||||
|
||||
return Successful();
|
||||
return Result.Success();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.Core.Application;
|
||||
using DigitalData.Core.Contracts.CultureServices;
|
||||
using DigitalData.UserManager.Application.Contracts;
|
||||
using DigitalData.UserManager.Application.DTOs.Module;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Services
|
||||
{
|
||||
public class ModuleService : BasicCRUDService<IModuleRepository, ModuleDto, Module, int>, IModuleService
|
||||
{
|
||||
public ModuleService(IModuleRepository repository, IKeyTranslationService translationService, IMapper mapper) : base(repository, translationService, mapper)
|
||||
public ModuleService(IModuleRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, localizer, mapper)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.Core.Application;
|
||||
using DigitalData.Core.Contracts.Application;
|
||||
using DigitalData.Core.Contracts.CultureServices;
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.UserManager.Application.Contracts;
|
||||
using DigitalData.UserManager.Application.DTOs.UserRep;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Services
|
||||
{
|
||||
public class UserRepService : CRUDService<IUserRepRepository, UserRepCreateDto, UserRepReadDto, UserRepUpdateDto, UserRep, int>, IUserRepService
|
||||
{
|
||||
public UserRepService(IUserRepRepository repository, IKeyTranslationService translationService, IMapper mapper) : base(repository, translationService, mapper)
|
||||
public UserRepService(IUserRepRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, localizer, mapper)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<IServiceResult<IEnumerable<UserRepReadDto>>> ReadAllAsync(bool withUser = false, bool withRepGroup = false, bool withRightGroup = false, bool withRepUser = false, int? userId = null)
|
||||
public async Task<DataResult<IEnumerable<UserRepReadDto>>> ReadAllAsync(bool withUser = false, bool withRepGroup = false, bool withRightGroup = false, bool withRepUser = false, int? userId = null)
|
||||
{
|
||||
var urs = await _repository.ReadAllAsync(withUser, withRepGroup, withRightGroup, withRepUser, userId);
|
||||
var urReadDTOs = _mapper.MapOrThrow<IEnumerable<UserRepReadDto>>(urs);
|
||||
return Successful(urReadDTOs);
|
||||
return Result.Success(urReadDTOs);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,70 +1,70 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.Core.Application;
|
||||
using DigitalData.Core.Contracts.Application;
|
||||
using DigitalData.Core.Contracts.CultureServices;
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.UserManager.Application.Contracts;
|
||||
using DigitalData.UserManager.Application.DTOs.User;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Services
|
||||
{
|
||||
public class UserService : CRUDService<IUserRepository, UserCreateDto, UserReadDto, UserUpdateDto, User, int>, IUserService
|
||||
{
|
||||
public UserService(IUserRepository repository, IKeyTranslationService translationService, IMapper mapper) : base(repository, translationService, mapper)
|
||||
public UserService(IUserRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, localizer, mapper)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<IServiceResult<IEnumerable<UserReadDto>>> ReadByModuleIdAsync(int moduleId)
|
||||
public async Task<DataResult<IEnumerable<UserReadDto>>> ReadByModuleIdAsync(int moduleId)
|
||||
{
|
||||
var users = await _repository.ReadByModuleIdAsync(moduleId);
|
||||
IEnumerable<UserReadDto> readDTOs = _mapper.MapOrThrow<IEnumerable<UserReadDto>>(users);
|
||||
return Successful(readDTOs);
|
||||
return Result.Success(readDTOs);
|
||||
}
|
||||
|
||||
public async Task<IServiceResult<IEnumerable<UserReadDto>>> ReadByGroupIdAsync(int groupId)
|
||||
public async Task<DataResult<IEnumerable<UserReadDto>>> ReadByGroupIdAsync(int groupId)
|
||||
{
|
||||
var users = await _repository.ReadByGroupIdAsync(groupId);
|
||||
IEnumerable<UserReadDto> readDTOs = _mapper.MapOrThrow<IEnumerable<UserReadDto>>(users);
|
||||
return Successful(readDTOs);
|
||||
return Result.Success(readDTOs);
|
||||
}
|
||||
|
||||
public async Task<IServiceResult<IEnumerable<UserReadDto>>> ReadUnassignedByModuleIdAsync(int moduleId)
|
||||
public async Task<DataResult<IEnumerable<UserReadDto>>> ReadUnassignedByModuleIdAsync(int moduleId)
|
||||
{
|
||||
var users = await _repository.ReadUnassignedByModuleIdAsync(moduleId);
|
||||
IEnumerable<UserReadDto> readDTOs = _mapper.MapOrThrow<IEnumerable<UserReadDto>>(users);
|
||||
return Successful(readDTOs);
|
||||
return Result.Success(readDTOs);
|
||||
}
|
||||
|
||||
public async Task<IServiceResult<IEnumerable<UserReadDto>>> ReadUnassignedByGroupIdAsync(int groupId)
|
||||
public async Task<DataResult<IEnumerable<UserReadDto>>> ReadUnassignedByGroupIdAsync(int groupId)
|
||||
{
|
||||
var users = await _repository.ReadUnassignedByGroupIdAsync(groupId);
|
||||
IEnumerable<UserReadDto> readDTOs = _mapper.MapOrThrow<IEnumerable<UserReadDto>>(users);
|
||||
return Successful(readDTOs);
|
||||
return Result.Success(readDTOs);
|
||||
}
|
||||
|
||||
public async Task<IServiceResult<int>> CreateAsync(UserPrincipalDto upDto)
|
||||
public async Task<DataResult<int>> CreateAsync(UserPrincipalDto upDto)
|
||||
{
|
||||
var user = _mapper.MapOrThrow<User>(upDto);
|
||||
|
||||
if (await HasEntity(user.Guid))
|
||||
return Failed<int>(MessageKey.UserAlreadyExists.ToString());
|
||||
return Result.Fail<int>().Message(_localizer[Key.UserAlreadyExists]);
|
||||
|
||||
var createdUser = await _repository.CreateAsync(user);
|
||||
if (createdUser is null)
|
||||
return Failed<int>();
|
||||
return Result.Fail<int>();
|
||||
else
|
||||
return Successful(KeyValueOf(createdUser));
|
||||
return Result.Success(KeyValueOf(createdUser));
|
||||
}
|
||||
|
||||
public async Task<IServiceResult<UserReadDto>> ReadByUsernameAsync(string username)
|
||||
public async Task<DataResult<UserReadDto>> ReadByUsernameAsync(string username)
|
||||
{
|
||||
var user = await _repository.ReadByUsernameAsync(username);
|
||||
if (user is null)
|
||||
return Failed<UserReadDto>(MessageKey.UserNotFoundInLocalDB.ToString());
|
||||
return Result.Fail<UserReadDto>().Message(_localizer[Key.UserNotFoundInLocalDB]);
|
||||
|
||||
var userDto = _mapper.MapOrThrow<UserReadDto>(user);
|
||||
return Successful(userDto);
|
||||
return Result.Success(userDto);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@@ -64,8 +64,10 @@ E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.Application\obj\Deb
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.Application\obj\Debug\net7.0\DigitalData.UserManager.Application.AssemblyInfoInputs.cache
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.Application\obj\Debug\net7.0\DigitalData.UserManager.Application.AssemblyInfo.cs
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.Application\obj\Debug\net7.0\DigitalData.UserManager.Application.csproj.CoreCompileInputs.cache
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.Application\obj\Debug\net7.0\DigitalData.UserManager.Application.csproj.CopyComplete
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.Application\obj\Debug\net7.0\DigitalData.UserManager.Application.dll
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.Application\obj\Debug\net7.0\refint\DigitalData.UserManager.Application.dll
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.Application\obj\Debug\net7.0\DigitalData.UserManager.Application.pdb
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.Application\obj\Debug\net7.0\ref\DigitalData.UserManager.Application.dll
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.Application\bin\Debug\net7.0\DigitalData.Core.DTO.dll
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.Application\bin\Debug\net7.0\DigitalData.Core.DTO.pdb
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.Application\obj\Debug\net7.0\DigitalD.78E1DF98.Up2Date
|
||||
|
||||
Reference in New Issue
Block a user