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)); }
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); }
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); }