Пример #1
0
        public async Task <ElasticSearchIndexJob> UpdateElasticSearchIndexJob(ElasticSearchIndexJob job)
        {
            // Get entity from database
            var entity_job = await mintplayer_context.ElasticSearchIndexJobs.FindAsync(job.Id);

            // Set properties
            entity_job.Status = job.JobStatus;

            // Update
            mintplayer_context.ElasticSearchIndexJobs.Update(entity_job);

            return(ToDto(entity_job, false, false));
        }
Пример #2
0
        public async Task <ElasticSearchIndexJob> InsertElasticSearchIndexJob(ElasticSearchIndexJob job)
        {
            // Convert to entity
            var entity_job = ToEntity(job, mintplayer_context);

            // Add to database
            await mintplayer_context.ElasticSearchIndexJobs.AddAsync(entity_job);

            await mintplayer_context.SaveChangesAsync();

            var new_job = ToDto(entity_job, false, false);

            return(new_job);
        }
Пример #3
0
        internal static Entities.Jobs.ElasticSearchIndexJob ToEntity(ElasticSearchIndexJob job, MintPlayerContext mintplayer_context)
        {
            if (job == null)
            {
                return(null);
            }
            var entity_job = new Entities.Jobs.ElasticSearchIndexJob
            {
                Id            = job.Id,
                Status        = job.JobStatus,
                Subject       = mintplayer_context.Subjects.Find(job.Subject.Id),
                SubjectStatus = job.SubjectStatus
            };

            return(entity_job);
        }