Example #1
0
 public int GetHighestId()
 {
     using (var context = new Images3DataContext(_connectionString))
     {
         return(context.Images.OrderByDescending(i => i.Id).FirstOrDefault().Id);
     }
 }
Example #2
0
 public Images GetImageForId(int id)
 {
     using (var context = new Images3DataContext(_connectionString))
     {
         return(context.Images.FirstOrDefault(i => i.Id == id));
     }
 }
Example #3
0
 public IEnumerable <Images> GetAllImages()
 {
     using (var context = new Images3DataContext(_connectionString))
     {
         return(context.Images.OrderByDescending(i => i.Id).ToList());
     }
 }
Example #4
0
 public int GetLikesForId(int id)
 {
     using (var context = new Images3DataContext(_connectionString))
     {
         Images image = context.Images.FirstOrDefault(i => i.Id == id);
         return(image.LikeCount);
     }
 }
Example #5
0
 public void AddImage(Images image)
 {
     using (var context = new Images3DataContext(_connectionString))
     {
         context.Images.InsertOnSubmit(image);
         context.SubmitChanges();
     }
 }
Example #6
0
 public void AddLikeForId(int id)
 {
     using (var context = new Images3DataContext(_connectionString))
     {
         Images image = context.Images.FirstOrDefault(i => i.Id == id);
         image.LikeCount++;
         context.SubmitChanges();
     }
 }