public async Task <RefreshTokenViewModel> GetRefreshToken(int viewModelId) { var result = await _refreshTokenRepository.GetAllMatchingAsync(rt => rt.UserId == viewModelId); if (result.Any()) { return(_refreshMapper.GetViewModel(result.FirstOrDefault())); } var newRefreshToken = GetNewRefreshToken(viewModelId); await _refreshTokenRepository.AddAsync(newRefreshToken); return(_refreshMapper.GetViewModel(newRefreshToken)); }
public virtual TViewModel AddWithResponse(TViewModel viewModel) { var entity = SetUserOnAdd(_mapper.GetEntity(viewModel), _serviceUser); _repository.Add(entity, _autoSave); return(_mapper.GetViewModel(entity)); }