Пример #1
0
 public static void DeleteAdvert(Advert ad)
 {
     try
     {
         AdvertContext db = new AdvertContext(options);
         db.Advert.Remove(ad);
         db.SaveChanges();
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
     }
 }
Пример #2
0
 public static void EditAdvert(int id, string name, int animalAge, decimal animalWeight, string kindOfAnimal, string description, string pictureString)
 {
     try
     {
         AdvertContext db = new AdvertContext(options);
         Advert        ad = new Advert(id, name, animalAge, animalWeight, kindOfAnimal, description, pictureString, DateTime.Now);
         db.Advert.Update(ad);
         db.SaveChanges();
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
     }
 }