private RoleMapping MapToEntity(RoleMappingModel model, string requestId = "") { // Perform mapping var entity = RoleMapping.Empty; entity.Id = model.Id ?? String.Empty; entity.AdGroupName = model.AdGroupName ?? String.Empty; entity.Role = new Role { Id = model.Role.Id, DisplayName = model.Role.DisplayName }; entity.Permissions = new List <Permission>(); foreach (var item in model.Permissions) { var permission = new Permission() { Id = item.Id, Name = item.Name }; entity.Permissions.Add(permission); } return(entity); }
private RoleMapping MapToEntity(RoleMappingModel model, string requestId = "") { // Perform mapping var entity = RoleMapping.Empty; entity.Id = model.Id ?? String.Empty; entity.AdGroupName = model.AdGroupName ?? String.Empty; entity.AdGroupId = model.AdGroupId ?? String.Empty; entity.RoleName = model.RoleName ?? String.Empty; entity.ProcessStep = model.ProcessStep ?? String.Empty; entity.ProcessType = model.ProcessType ?? String.Empty; entity.Channel = model.Channel ?? String.Empty; return(entity); }
public async Task <StatusCodes> UpdateItemAsync(RoleMappingModel modelObject, string requestId = "") { _logger.LogInformation($"RequestId: {requestId} - RoleMapping_UpdateItemAsync called."); Guard.Against.Null(modelObject, nameof(modelObject), requestId); try { var entityObject = MapToEntity(modelObject, requestId); var result = await _roleMappingRepository.UpdateItemAsync(entityObject, requestId); Guard.Against.NotStatus200OK(result, "RoleMapping_UpdateItemAsync", requestId); return(result); } catch (Exception ex) { _logger.LogError($"RequestId: {requestId} - RoleMapping_UpdateItemAsync Service Exception: {ex}"); throw new ResponseException($"RequestId: {requestId} - RoleMapping_UpdateItemAsync Service Exception: {ex}"); } }