public virtual async Task <bool> Exists(K id)
        {
            var result = await _dbService.GetDocument <T>(id.ToString()).ConfigureAwait(false);

            return(result != null &&
                   (!(result is ISoftDelete) || !(result as ISoftDelete).IsDeleted));
        }
Exemplo n.º 2
0
        public virtual async Task <T> Get(K id)
        {
            var result = await DocumentDbService.GetDocument <T>(id.ToString()).ConfigureAwait(false);

            if (result == null || result is ISoftDelete && (result as ISoftDelete).IsDeleted)
            {
                throw new NotFoundException <T>($"Could not find {typeof(T).Name} entity with ID {id}");
            }

            return(result);
        }
Exemplo n.º 3
0
        public async Task <T> GetDocument <T>(string documentId)
        {
            T   document;
            var fullDocumentId = DocumentDbHelpers.GetFullDocumentId <T>(documentId);

            if (!_cache.TryGetValue(fullDocumentId, out document))
            {
                document = await _innerDocumentDbService.GetDocument <T>(documentId);

                if (document != null)
                {
                    var cacheEntryOptions = new MemoryCacheEntryOptions()
                                            .SetSlidingExpiration(TimeSpan.FromSeconds(30));
                    _cache.Set(fullDocumentId, document, cacheEntryOptions);
                }
            }
            return(document);
        }
Exemplo n.º 4
0
 public Task <ApiResource> FindApiResourceAsync(string name)
 {
     return(DocumentDbService.GetDocument <ApiResource>(name));
 }
Exemplo n.º 5
0
 public Task <PersistedGrant> GetAsync(string key)
 {
     return(_documentDbService.GetDocument <PersistedGrant>(key));
 }
Exemplo n.º 6
0
 public Task <T> GetDocument <T>(string documentId)
 {
     return(_innerDocumentDbService.GetDocument <T>(documentId));
 }
Exemplo n.º 7
0
 public Task <Client> FindClientByIdAsync(string clientId)
 {
     return(_documentDbService.GetDocument <Client>(clientId));
 }
Exemplo n.º 8
0
        /// <summary>
        /// Get Job using job id
        /// </summary>
        /// <param name="JobId"></param>
        /// <returns></returns>
        public JobMain GetJob(long JobId)
        {
            var job = _jobPostRepo.GetJob(JobId);

            job.DocumentData = _documentDbService.GetDocument(job.JobMainId);
            long companyId = _compnyHasJobService.GetCompanyId(job.JobMainId);

            job.CompanyDetails = _compnyDataService.GetCompanyDetailsByCompanyId(companyId);
            job.CompanyLogo    = _documentDbService.GetDocument(companyId);
            job.TagsList       = _tagService.GetTags(job.JobMainId);
            job.TagName        = _tagService.GetTags(job.JobMainId).Count() > 0 ? string.Join(",", _tagService.GetTags(job.JobMainId).Select(d => d.TagName).ToList()) : null;
            return(job);
        }