コード例 #1
0
        public async Task <bool> IsExistingAsync(string userAccountLogin)
        {
            var userAccountLogText = $"user account with login '{userAccountLogin}'";

            _logger.Information($"Checking if {userAccountLogText} exists...");

            var isExisting = await _repository.GetNoTrackingQuery()
                             .AnyAsync(account => account.Login == userAccountLogin);

            if (isExisting)
            {
                _logger.Information($"Done, {userAccountLogText} exists");
            }
            else
            {
                _logger.Information($"Done, {userAccountLogText} does not exist");
            }

            return(isExisting);
        }
コード例 #2
0
ファイル: ReportDataService.cs プロジェクト: m12e/Stars
        public async Task <ReportModel[]> GetAllOrderedAsync()
        {
            _logger.Information("Getting all reports ordered by date of creation...");

            var reports = await _repository.GetNoTrackingQuery()
                          .OrderBy(report => report.DateOfCreationUtc)
                          .ForEachOfQueryable(report =>
            {
                report.DateOfCreationUtc = DateTime.SpecifyKind(report.DateOfCreationUtc, DateTimeKind.Utc);
            })
                          .ToArrayAsync();

            var reportModels = _mapper.Map <ReportModel[]>(reports);

            _logger.Information($"All reports were successfully loaded (count = {reportModels.Length})");

            return(reportModels);
        }