public async Task <bool> UpdateAsync(App app) { _dbContext.Update(app); var x = await _dbContext.SaveChangesAsync(); var result = x > 0; return(result); }
public async Task <bool> UpdateAsync(Setting setting) { _dbContext.Update(setting); var x = await _dbContext.SaveChangesAsync(); return(x > 0); }
public async Task <bool> AddAsync(QzRunLogEntity log) { #region mongo QzRunLogMoEntity mlog = new QzRunLogMoEntity(); mlog.AppId = log.AppId; mlog.TasksQzId = log.TasksQzId; mlog.LogText = log.LogText; mlog.LogTime = log.LogTime?.AddHours(8); mlog.Milliseconds = log.Milliseconds; mlog.LogType = (int)log.LogType; await _mongoRepository.InsertAsync(mlog); #endregion var result = false; var list = await _dbContext.QzRunLogs.Where(x => x.TasksQzId == log.TasksQzId && x.AppId == log.AppId).ToListAsync(); if (list.Count >= _logCount.ObjToInt()) { var oldLog = list.OrderBy(x => x.LogTime).First(); log.Id = oldLog.Id; _dbContext.Update(log); var y = await _dbContext.SaveChangesAsync(); result = y > 0; return(result); } await _dbContext.QzRunLogs.AddAsync(log); int x = await _dbContext.SaveChangesAsync(); result = x > 0; return(result); }
public async Task <bool> UpdateAsync(TasksQzEntity qz) { _dbContext.Update(qz); var x = await _dbContext.SaveChangesAsync(); var result = x > 0; return(result); }
public async Task <bool> UpdateAsync(ServerNode node) { _dbContext.Update(node); var x = await _dbContext.SaveChangesAsync(); var result = x > 0; return(result); }
public async Task <bool> UpdateAsync(Config config) { _dbContext.Update(config); var x = await _dbContext.SaveChangesAsync(); var result = x > 0; if (result) { ClearAppPublishedConfigsMd5Cache(config.AppId); } return(result); }
public async Task <bool> AddAsync(QzRunLogEntity log) { var result = false; var list = await _dbContext.QzRunLogs.Where(x => x.TasksQzId == log.TasksQzId && x.AppId == log.AppId).ToListAsync(); if (list.Count >= _logCount.ObjToInt()) { var oldLog = list.OrderBy(x => x.LogTime).First(); log.Id = oldLog.Id; _dbContext.Update(log); var y = await _dbContext.SaveChangesAsync(); result = y > 0; return(result); } await _dbContext.QzRunLogs.AddAsync(log); int x = await _dbContext.SaveChangesAsync(); result = x > 0; return(result); }