protected override async Task <MappingFilterableViewModel <TViewModel, TFilter, TMappingRestriction, TRefs> > GetListModel(TFilter filter, bool throwOnException = true) { var model = new MappingFilterableViewModel <TViewModel, TFilter, TMappingRestriction, TRefs> { InitialLoadPageSize = _initialLoadPageSize, PageSize = _pageSize, }; var errorMessage = $"Failed to get {EntityName} items list"; try { model.Restrictions = await _entityRepository.GetRestrictions(); model.MappingData.Mappings = await GetFilteredItems(filter); await FillReferences(model.Refs); } catch (PublicException ex) { if (throwOnException) { throw; } _logger.Error(errorMessage, ex); model.Error = ex.Message; } catch (Exception ex) { if (throwOnException) { throw; } _logger.Error(errorMessage, ex); model.Error = errorMessage; } await GetMappingSyncState(model, throwOnException); model.Filter = filter; return(model); }
protected async Task GetMappingSyncState <TViewModel, TFilter, TRestriction, TReferences>(MappingFilterableViewModel <TViewModel, TFilter, TRestriction, TReferences> model, bool throwOnException) where TViewModel : class, IMapping where TFilter : class, IFilter, new() where TRestriction : class where TReferences : class, new() { try { model.MappingData.IsSynced = await _mappingSyncLogic.GetSyncMappingState(); } catch (PublicException ex) { if (throwOnException) { throw; } _logger.Error(Constants.FailedToGetMappingSyncStateMessage, ex); model.Error = ex.Message; } catch (Exception ex) { if (throwOnException) { throw; } var message = Constants.FailedToGetMappingSyncStateMessage; _logger.Error(message, ex); model.Error = message; } }