private async Task BuildApiScopePropertiesViewModelAsync(ApiScopePropertiesDto apiScopeProperties) { var apiResourcePropertiesDto = await GetApiScopePropertiesAsync(apiScopeProperties.ApiScopeId); apiScopeProperties.ApiScopeProperties.AddRange(apiResourcePropertiesDto.ApiScopeProperties); apiScopeProperties.TotalCount = apiResourcePropertiesDto.TotalCount; }
public async Task <IActionResult> ApiScopePropertyDelete(ApiScopePropertiesDto apiScopeProperty) { await _apiScopeService.DeleteApiScopePropertyAsync(apiScopeProperty); SuccessNotification(_localizer["SuccessDeleteApiScopeProperty"], _localizer["SuccessTitle"]); return(RedirectToAction(nameof(ApiScopeProperties), new { Id = apiScopeProperty.ApiScopeId })); }
public virtual async Task <int> DeleteApiScopePropertyAsync(ApiScopePropertiesDto apiScopeProperty) { var propertyEntity = apiScopeProperty.ToEntity(); var deleted = await ApiScopeRepository.DeleteApiScopePropertyAsync(propertyEntity); await AuditEventLogger.LogEventAsync(new ApiScopePropertyDeletedEvent(apiScopeProperty)); return(deleted); }
public async Task <IActionResult> ApiScopeProperties(ApiScopePropertiesDto apiScopeProperty) { if (!ModelState.IsValid) { return(View(apiScopeProperty)); } await _apiScopeService.AddApiScopePropertyAsync(apiScopeProperty); SuccessNotification(string.Format(_localizer["SuccessAddApiScopeProperty"], apiScopeProperty.Key, apiScopeProperty.ApiScopeName), _localizer["SuccessTitle"]); return(RedirectToAction(nameof(ApiScopeProperties), new { Id = apiScopeProperty.ApiScopeId })); }
public virtual async Task <int> AddApiScopePropertyAsync(ApiScopePropertiesDto apiScopeProperties) { var canInsert = await CanInsertApiScopePropertyAsync(apiScopeProperties); if (!canInsert) { await BuildApiScopePropertiesViewModelAsync(apiScopeProperties); throw new UserFriendlyViewException(string.Format(ApiScopeServiceResources.ApiScopePropertyExistsValue().Description, apiScopeProperties.Key), ApiScopeServiceResources.ApiScopePropertyExistsKey().Description, apiScopeProperties); } var apiScopeProperty = apiScopeProperties.ToEntity(); var saved = await ApiScopeRepository.AddApiScopePropertyAsync(apiScopeProperties.ApiScopeId, apiScopeProperty); await AuditEventLogger.LogEventAsync(new ApiScopePropertyAddedEvent(apiScopeProperties)); return(saved); }
public static ApiScopeProperty ToEntity(this ApiScopePropertiesDto resource) { return(resource == null ? null : Mapper.Map <ApiScopeProperty>(resource)); }
public ApiScopePropertiesRequestedEvent(int apiScopeId, ApiScopePropertiesDto apiScopeProperties) { ApiScopeId = apiScopeId; ApiResourceProperties = apiScopeProperties; }
public ApiScopePropertyAddedEvent(ApiScopePropertiesDto apiScopeProperty) { ApiScopeProperty = apiScopeProperty; }
public ApiScopePropertyRequestedEvent(int apiScopePropertyId, ApiScopePropertiesDto apiScopeProperty) { ApiScopePropertyId = apiScopePropertyId; ApiScopeProperty = apiScopeProperty; }
public virtual async Task <bool> CanInsertApiScopePropertyAsync(ApiScopePropertiesDto apiResourceProperty) { var resource = apiResourceProperty.ToEntity(); return(await ApiScopeRepository.CanInsertApiScopePropertyAsync(resource)); }
public ApiScopePropertyDeletedEvent(ApiScopePropertiesDto apiScopeProperty) { ApiScopeProperty = apiScopeProperty; }