public void AddMonkeyLog(MonkeyLog x) { using (var context = new MonkeyDbContext()) { context.MonkeyLogs.Add(x); context.SaveChanges(); } }
public int GetLastMonkeyId() { int lastId = 0; using (var context = new MonkeyDbContext()) { int logCount = context.ActionLogs.Count(); if (logCount > 0) { lastId = context.ActionLogs.Select(x => x.MonkeyId).ToList().Max(); } } return(lastId); }
public int GetLastWoodId() { int lastId = 0; using (var context = new MonkeyDbContext()) { int logCount = context.ActionLogs.Count(); if (logCount > 0) { lastId = context.ActionLogs.ToList().Last().WoodId; } } return(lastId); }