public static void DodajAccomodation(Accommodation smestaj) { using (Entities db = new Entities()) { try { db.Accommodations.Add(smestaj); db.SaveChanges(); } catch (Exception) { } } }
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 { } } }