Example #1
0
 public void AddAnimal(Animal animal)
 {
     using (var data = new AnimalEntities())
     {
         data.Animal.Add(animal);
         data.SaveChanges();
     }
 }
Example #2
0
 public void AddAnimalType(AnimalTypes type)
 {
     using (var data = new AnimalEntities())
     {
         data.AnimalTypes.Add(type);
         data.SaveChanges();
     }
 }
Example #3
0
 public void DeleteAnimal(int id)
 {
     using (var data = new AnimalEntities())
     {
         Animal type = (Animal)data.Animal.Where(x => x.Id == id).First();
         data.Animal.Remove(type);
         data.SaveChanges();
     }
 }
Example #4
0
 public void UpdateAnimalType(AnimalTypes type)
 {
     using (var data = new AnimalEntities())
     {
         data.AnimalTypes.Attach(type);
         var entry = data.Entry(type);
         entry.State = System.Data.Entity.EntityState.Modified;
         data.SaveChanges();
     }
 }