aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortranstrike <transtrike@gmail.com>2020-12-10 18:04:07 +0200
committertranstrike <transtrike@gmail.com>2020-12-10 18:04:07 +0200
commit4e75e0150d8ba9fdc82e61516b42d04dc09e9d59 (patch)
tree8c80fb72a895ad0f5fe492bc220670b95a68836f
parentc13ff5b569248c0c2f05b154eda8199e0ce96cf8 (diff)
downloadDevHive-4e75e0150d8ba9fdc82e61516b42d04dc09e9d59.tar
DevHive-4e75e0150d8ba9fdc82e61516b42d04dc09e9d59.tar.gz
DevHive-4e75e0150d8ba9fdc82e61516b42d04dc09e9d59.zip
Added Id in UserDto
-rw-r--r--API/Service/UserService.cs8
-rw-r--r--API/Startup.cs17
-rw-r--r--Models/DTOs/UserDTO.cs1
3 files changed, 5 insertions, 21 deletions
diff --git a/API/Service/UserService.cs b/API/Service/UserService.cs
index bd991dd..d84d74b 100644
--- a/API/Service/UserService.cs
+++ b/API/Service/UserService.cs
@@ -20,11 +20,8 @@ namespace API.Service
public UserService(DevHiveContext context, IMapper mapper)
{
this._dbRepository = new DbRepository<User>(context);
- this._userMapper = new Mapper
- (
- new MapperConfiguration
- (cfg => cfg.CreateMap<UserDTO, User>())
- );
+ this._userMapper = new Mapper(new MapperConfiguration(cfg =>
+ cfg.CreateMap<UserDTO, User>()));
}
public async Task<HttpStatusCode> CreateUser(UserDTO userDTO)
@@ -46,7 +43,6 @@ namespace API.Service
public async Task<HttpStatusCode> UpdateUser(int id, UserDTO userDTO)
{
User user = this._userMapper.Map<User>(userDTO);
- user.Id = id;
await this._dbRepository.EditAsync(id, user);
return HttpStatusCode.OK;
diff --git a/API/Startup.cs b/API/Startup.cs
index 6d95c1a..548274c 100644
--- a/API/Startup.cs
+++ b/API/Startup.cs
@@ -82,21 +82,8 @@ namespace API
//cfg.DestinationMemberNamingConvention = new ExactMatchNamingConvention();
cfg.CreateMap<User, UserDTO>();
- cfg.CreateMap<UserDTO, User>()
- .ForMember(x => x.AccessFailedCount, o => o.Ignore())
- .ForMember(x => x.ConcurrencyStamp, o => o.Ignore())
- .ForMember(x => x.EmailConfirmed, o => o.Ignore())
- .ForMember(x => x.Id, o => o.Ignore())
- .ForMember(x => x.LockoutEnabled, o => o.Ignore())
- .ForMember(x => x.LockoutEnd, o => o.Ignore())
- .ForMember(x => x.NormalizedEmail, o => o.Ignore())
- .ForMember(x => x.NormalizedUserName, o => o.Ignore())
- .ForMember(x => x.PasswordHash, o => o.Ignore())
- .ForMember(x => x.PhoneNumber, o => o.Ignore())
- .ForMember(x => x.PhoneNumberConfirmed, o => o.Ignore())
- .ForMember(x => x.ProfilePicture, o => o.Ignore())
- .ForMember(x => x.SecurityStamp, o => o.Ignore())
- .ForMember(x => x.TwoFactorEnabled, o => o.Ignore());
+ cfg.CreateMap<UserDTO, User>();
+
}).CreateMapper();
}
}
diff --git a/Models/DTOs/UserDTO.cs b/Models/DTOs/UserDTO.cs
index 60e98c2..6c4e273 100644
--- a/Models/DTOs/UserDTO.cs
+++ b/Models/DTOs/UserDTO.cs
@@ -2,6 +2,7 @@ namespace Models.DTOs
{
public class UserDTO
{
+ public int Id { get; set; }
public string UserName { get; set; }
public string Email { get; set; }
public string FirstName { get; set; }