/// <summary> /// Update calculation. /// </summary> /// <param name="calculation"> Calculation entity. </param> /// <returns></returns> public async Task UpdateAsync(Calculation calculation) { _logger.LogInformation("Inside the repository about to call UpdateAsync."); _dbContext.Entry(calculation).State = EntityState.Modified; await _dbContext.SaveChangesAsync(); }
public async Task <bool> UpdateAsync(ServerFormula entity) { if (!Validator.Validate(entity)) { return(false); } var statusCorrect = await CheckStatus(entity, DateTime.UtcNow + TimeSpan.FromSeconds(25)); if (!statusCorrect) { return(false); } statusManager.ChangeStatus(entity, CommonLibrary.Model.FormulaStatus.Updated); db.Entry(entity).State = EntityState.Modified; bool saveSucces = await db.SaveChangesAsync() > 0; statusManager.Notify(); return(saveSucces); }