public Area GetById(Expression <Func <Area, bool> > filter) { using (advYumitGyulerContext context = new advYumitGyulerContext()) { return(context.Areas.Include("ActivityLogs").SingleOrDefault(filter)); } }
public List <Area> GetAll() { using (advYumitGyulerContext context = new advYumitGyulerContext()) { return(context.Set <Area>().ToList()); } }
public List <Area> GetByAreaType(int typeId) { using (advYumitGyulerContext context = new advYumitGyulerContext()) { return(context.Areas.Include("ActivityLogs").Where(a => a.AreaTypeId == typeId).ToList()); } }
public List <ActivityLog> GetById(Expression <Func <ActivityLog, bool> > filter) { using (advYumitGyulerContext context = new advYumitGyulerContext()) { return(context.ActivityLogs.Include("Hamster").Where(filter).ToList()); } }
public List <Hamster> GetAll() { using (advYumitGyulerContext context = new advYumitGyulerContext()) { return(context.Hamsters.Include("ActivityLogs").ToList()); } }
public Hamster GetById(int id) { using (advYumitGyulerContext context = new advYumitGyulerContext()) { return(context.Hamsters.Include("ActivityLogs").SingleOrDefault(h => h.Id == id)); } }
public void Update(Area area) { using (advYumitGyulerContext context = new advYumitGyulerContext()) { var addedEntity = context.Entry(area); addedEntity.State = EntityState.Modified; context.SaveChanges(); } }
public void Add(ActivityLog activityLog) { using (advYumitGyulerContext context = new advYumitGyulerContext()) { var addedEntity = context.Entry(activityLog); addedEntity.State = EntityState.Added; context.SaveChanges(); } }
static void Main(string[] args) { var dbContext = new advYumitGyulerContext(); dbContext.Database.EnsureCreated(); Console.Write("How many days do you want the simulation to take?: "); int days = int.Parse(Console.ReadLine()); Console.Write("How fast do you want the simulation to progress?(Tics per second): "); int ticksPerSecond = int.Parse(Console.ReadLine()); Tick tick = new Tick(ticksPerSecond, days); }