Exemple #1
0
 public void Remove(IList <Photo> items)
 {
     using (PhotoAlbumDbContext ctx = new PhotoAlbumDbContext())
     {
         foreach (Photo p in items)
         {
             ctx.Photos.Remove(p);
         }
         ctx.SaveChanges();
     }
 }
Exemple #2
0
 public void Add(Photo item)
 {
     using (PhotoAlbumDbContext ctx = new PhotoAlbumDbContext())
     {
         ctx.Photos.Add(item);
         item.Resolution.Photo   = item;
         item.Resolution.PhotoId = item.Id;
         ctx.Resolutions.Add(item.Resolution);
         ctx.SaveChanges();
     }
 }
Exemple #3
0
        public void Remove(Photo item)
        {
            if (item == null)
            {
                return;
            }

            using (PhotoAlbumDbContext ctx = new PhotoAlbumDbContext())
            {
                ctx.Photos.Remove(item);
                ctx.SaveChanges();
            }
        }
Exemple #4
0
 public void Add(IList <Photo> items)
 {
     using (PhotoAlbumDbContext ctx = new PhotoAlbumDbContext())
     {
         foreach (Photo p in items)
         {
             ctx.Photos.Add(p);
             p.Resolution.Photo   = p;
             p.Resolution.PhotoId = p.Id;
             ctx.Resolutions.Add(p.Resolution);
         }
         ctx.SaveChanges();
     }
 }