diff options
| author | transtrike <transtrike@gmail.com> | 2021-01-19 19:02:37 +0200 |
|---|---|---|
| committer | transtrike <transtrike@gmail.com> | 2021-01-19 19:02:37 +0200 |
| commit | 163827d4a8dbc4b41bfa0f78edc7dd30626e95d3 (patch) | |
| tree | 511aedb06c346671d6604e861c0b13cf93ae9299 | |
| parent | 4836e2f4cc3e1eb53f415d26771c76c84d29c280 (diff) | |
| download | DevHive-163827d4a8dbc4b41bfa0f78edc7dd30626e95d3.tar DevHive-163827d4a8dbc4b41bfa0f78edc7dd30626e95d3.tar.gz DevHive-163827d4a8dbc4b41bfa0f78edc7dd30626e95d3.zip | |
Fixed role id creeping up the chain
4 files changed, 8 insertions, 8 deletions
diff --git a/src/DevHive.Services/Interfaces/IRoleService.cs b/src/DevHive.Services/Interfaces/IRoleService.cs index a7a0e47..fd661be 100644 --- a/src/DevHive.Services/Interfaces/IRoleService.cs +++ b/src/DevHive.Services/Interfaces/IRoleService.cs @@ -10,7 +10,7 @@ namespace DevHive.Services.Interfaces Task<RoleServiceModel> GetRoleById(Guid id); - Task<bool> UpdateRole(RoleServiceModel roleServiceModel); + Task<bool> UpdateRole(UpdateRoleServiceModel roleServiceModel); Task<bool> DeleteRole(Guid id); } diff --git a/src/DevHive.Services/Models/Identity/Role/RoleServiceModel.cs b/src/DevHive.Services/Models/Identity/Role/RoleServiceModel.cs index 3f834ef..07249fe 100644 --- a/src/DevHive.Services/Models/Identity/Role/RoleServiceModel.cs +++ b/src/DevHive.Services/Models/Identity/Role/RoleServiceModel.cs @@ -1,10 +1,7 @@ -using System; - namespace DevHive.Services.Models.Identity.Role { public class RoleServiceModel { - public Guid Id { get; set; } public string Name { get; set; } } } diff --git a/src/DevHive.Services/Models/Identity/Role/UpdateRoleServiceModel.cs b/src/DevHive.Services/Models/Identity/Role/UpdateRoleServiceModel.cs index be71771..e21e6b4 100644 --- a/src/DevHive.Services/Models/Identity/Role/UpdateRoleServiceModel.cs +++ b/src/DevHive.Services/Models/Identity/Role/UpdateRoleServiceModel.cs @@ -1,7 +1,10 @@ +using System; + namespace DevHive.Services.Models.Identity.Role { public class UpdateRoleServiceModel { + public Guid Id { get; set; } public string Name { get; set; } } } diff --git a/src/DevHive.Services/Services/RoleService.cs b/src/DevHive.Services/Services/RoleService.cs index 0945624..3ebb7c8 100644 --- a/src/DevHive.Services/Services/RoleService.cs +++ b/src/DevHive.Services/Services/RoleService.cs @@ -47,15 +47,15 @@ namespace DevHive.Services.Services return this._roleMapper.Map<RoleServiceModel>(role); } - public async Task<bool> UpdateRole(RoleServiceModel roleServiceModel) + public async Task<bool> UpdateRole(UpdateRoleServiceModel updateRoleServiceModel) { - if (!await this._roleRepository.DoesRoleExist(roleServiceModel.Id)) + if (!await this._roleRepository.DoesRoleExist(updateRoleServiceModel.Id)) throw new ArgumentException("Role does not exist!"); - if (await this._roleRepository.DoesNameExist(roleServiceModel.Name)) + if (await this._roleRepository.DoesNameExist(updateRoleServiceModel.Name)) throw new ArgumentException("Role name already exists!"); - Role role = this._roleMapper.Map<Role>(roleServiceModel); + Role role = this._roleMapper.Map<Role>(updateRoleServiceModel); return await this._roleRepository.EditAsync(role); } |
