public void IncrementHangFireToday() { EServerConfig eConfig = GetEConfig(); var utcNow = DateTime.UtcNow; if (eConfig.lastHangfireDateUTC.HasValue && eConfig.lastHangfireDateUTC.Value.Date == utcNow.Date) { //vamos incrementar o count do hangfire para o dia eConfig.lastHangfireDateUTC = utcNow; if (eConfig.hangfireCountToday.HasValue) { eConfig.hangfireCountToday += 1; } else { eConfig.hangfireCountToday = 1; } } else //é outro dia. vamos resetar o count { eConfig.lastHangfireDateUTC = utcNow; eConfig.hangfireCountToday = 1; } table.Save(eConfig); }
public async Task <IActionResult> Save([FromBody] EServerConfig eConfig) { using (var context = new SMySQLContext()) { var e = context.Update(eConfig); await context.SaveChangesAsync(); return(Ok(e.Entity.id)); } }