Exemple #1
0
 public void AddNewPhoto(PhotoDataModel photo)
 {
     using (TheContext ctx = new TheContext())
     {
         ctx.Photos.Add(photo);
         ctx.SaveChanges();
     }
 }
Exemple #2
0
 public void SavePhotoInAlbum(Guid id, PhotoDataModel photo)
 {
     using (TheContext ctx = new TheContext())
     {
         var album = ctx.Albums.Include("Photos").FirstOrDefault(a => a.AlbumId == id);
         album.Photos.Add(photo);
         ctx.SaveChanges();
     }
 }