public void CreatePhotos(IList<Photo> photos) { using (var context = new PhotoContext()) { foreach (var photo in photos) { context.Photos.Add(photo); } context.SaveChanges(); } }
public void CreateTrip(string path, string title, string description) { using (var context = new PhotoContext()) { var trip = new Trip { Description = description, RootPath = path, TripName = title, }; context.Trips.Add(trip); context.SaveChanges(); } }
public void UpdatePhoto(Photo photo) { using (var context = new PhotoContext()) { Photo oldPhoto = context.Photos.FirstOrDefault(x => x.PhotoId == photo.PhotoId); oldPhoto.Description = photo.Description; context.SaveChanges(); } }