Пример #1
0
 public static void DodajAccomodation(Accommodation smestaj)
 {
     using (Entities db = new Entities())
     {
         try
         {
             db.Accommodations.Add(smestaj);
             db.SaveChanges();
         }
         catch (Exception)
         {
         }
     }
 }
Пример #2
0
 public static void IzmeniAccomodation(Accommodation smestaj)
 {
     using (Entities dbEntiti = new Entities())
     {
         Accommodation izmena = (from a in dbEntiti.Accommodations
                                 where a.AccommodationID == smestaj.AccommodationID
                                 select a).Single();
         izmena.Name            = smestaj.Name;
         izmena.AccommodationID = smestaj.AccommodationID;
         izmena.CityID          = smestaj.CityID;
         izmena.Address         = smestaj.Address;
         izmena.Phone           = smestaj.Phone;
         izmena.Email           = smestaj.Email;
         izmena.Description     = smestaj.Description;
         izmena.AccCategoryID   = smestaj.AccCategoryID;
         try
         {
             dbEntiti.SaveChanges();
         }
         catch
         {
         }
     }
 }