public async Task <bool> AddAsync(ModifyLog log) { _dbContext.ModifyLogs.Add(log); int 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> AddRangeAsync(IEnumerable <SysLog> logs) { await _dbContext.SysLogs.AddRangeAsync(logs); int x = await _dbContext.SaveChangesAsync(); return(x > 0); }
public async Task <bool> AddAsync(Setting setting) { await _dbContext.Settings.AddAsync(setting); int x = await _dbContext.SaveChangesAsync(); return(x > 0); }
public async Task <bool> AddAsync(TasksQzEntity qz) { await _dbContext.TasksQzs.AddAsync(qz); int x = await _dbContext.SaveChangesAsync(); var result = x > 0; return(result); }
public async Task <bool> AddAsync(AppEntity app) { await _dbContext.Apps.AddAsync(app); int x = await _dbContext.SaveChangesAsync(); var result = x > 0; return(result); }
public async Task <bool> AddAsync(ServerNode node) { await _dbContext.ServerNodes.AddAsync(node); int x = await _dbContext.SaveChangesAsync(); var result = x > 0; return(result); }
public async Task <bool> AddAsync(Config config) { await _dbContext.Configs.AddAsync(config); int x = await _dbContext.SaveChangesAsync(); var result = x > 0; if (result) { ClearAppPublishedConfigsMd5Cache(config.AppId); } return(result); }
public async Task <bool> AddAsync(User user) { var old = await _dbContext.Users.Where(u => u.UserName == user.UserName && u.Status == UserStatus.Normal).FirstAsync(); if (old != null) { return(false); } await _dbContext.Users.AddAsync(user); var result = await _dbContext.SaveChangesAsync(); return(result > 0); }
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); }