Exemplo n.º 1
0
 public void AddImage(Image image)
 {
     using (var context = new ImageDataContext(_connectionString))
     {
         context.Images.InsertOnSubmit(image);
         context.SubmitChanges();
     }
 }
Exemplo n.º 2
0
 public void AddLike(int id)
 {
     using (var context = new ImageDataContext(_connectionString))
     {
         Image image = GetImage(id);
         image.Likes = image.Likes + 1;
         context.Images.Attach(image);
         context.Refresh(System.Data.Linq.RefreshMode.KeepCurrentValues, image);
         context.SubmitChanges();
     }
 }