public static void WriteCovenantLog(string message, int covenantId, bool isImportant) { ICovenantLogRepository covLogRepo = new EFCovenantLogRepository(); var log = new CovenantLog { CovenantId = covenantId, Message = message, Timestamp = DateTime.UtcNow, IsImportant = isImportant, }; covLogRepo.SaveCovenantLog(log); }
public static void UpgradeCovenant(Covenant covenant) { ICovenantRepository covRepo = new EFCovenantRepository(); var dbCovenant = covRepo.Covenants.FirstOrDefault(i => i.Id == covenant.Id); dbCovenant.Money -= GetUpgradeCost(covenant); dbCovenant.Level++; covRepo.SaveCovenant(dbCovenant); ICovenantLogRepository covLogRepo = new EFCovenantLogRepository(); var newlog = new CovenantLog { CovenantId = covenant.Id, IsImportant = true, Message = "The covenant leader has upgraded the covenant safeground to level " + (covenant.Level + 1) + ", allowing it to hold more furniture.", Timestamp = DateTime.UtcNow, }; covLogRepo.SaveCovenantLog(newlog); }
public static IEnumerable <CovenantLog> GetCovenantLogs(int covenantId) { ICovenantLogRepository covLogRepo = new EFCovenantLogRepository(); return(covLogRepo.CovenantLogs.Where(l => l.CovenantId == covenantId).OrderByDescending(l => l.Timestamp).Take(100)); }