Beispiel #1
0
 public IEnumerable <Camper> GetCampers(int year)
 {
     using (var context = new CampContext(_connectionString))
     {
         return(context.Campers.Where(i => i.Year == year).ToList());
     }
 }
Beispiel #2
0
        public Camper GetCamperInfo(int id)
        {
            using (var context = new CampContext(_connectionString))

            {
                return(context.Campers.FirstOrDefault(i => i.Id == id));
            }
        }
Beispiel #3
0
        public void AddCamper(Camper c)
        {
            using (var context = new CampContext(_connectionString))
            {
                context.Campers.Add(c);

                context.SaveChanges();
            }
        }