public async Task UpdateBEExecution(BEExecution updatedBEExecution) { using (var db = new BEMainDBContext()) { db.BEExecutions.AddOrUpdate(updatedBEExecution); await db.SaveChangesAsync(); } }
public async Task <BEExecution> GetBEExecution(int id) { BEExecution bEExecution = null; using (var db = new BEMainDBContext()) { bEExecution = await db.BEExecutions.FindAsync(id); } return(bEExecution); }
public async Task <BEExecution> PostBEExecution(BEExecution newBEExecution) { BEExecution createdBEExecution = null; using (var db = new BEMainDBContext()) { createdBEExecution = db.BEExecutions.Add(newBEExecution); await db.SaveChangesAsync(); } return(createdBEExecution); }
/************************* Internal Methods *************************/ // Creates the BEExecution, in a Reliable way (if it hasn't already been created) private async Task initExecution(BESearchRequest theSearchRequest) { if (theSearchRequest.hasCreatedLastExecution() == false) { BEExecution createdBEExecution = await dbHandlerService.StoreExecution( new BEExecution( theSearchRequest.ID, DateTime.Now, null )); theSearchRequest.ActiveExecutionID = createdBEExecution.ID; await SaveTheSearchRequest(theSearchRequest); } }
public async Task UpdateSearchRequestFulfilled(int searchRequestID, int executionID, Results theResults) { BESearchRequest theSReq = await TheSReqsContr.GetBESearchRequest(searchRequestID); theSReq.TheStatus = Status.Fulfilled; await TheSReqsContr.UpdateBESearchRequest(theSReq); BEExecution theExec = await TheExecsContr.GetBEExecution(executionID); theExec.FinishedOn = DateTime.Now; await TheExecsContr.UpdateBEExecution(theExec); theResults.ID = executionID; await TheResultsContr.PostResults(theResults); }
/*---------- Execution Management ----------*/ public async Task <BEExecution> StoreExecution(BEExecution newBEExecution) { return(await TheExecsContr.PostBEExecution(newBEExecution)); }