public int GetLikesCount(int Id)
 {
     using (var context = new PictureContext(_connectionString))
     {
         return(context.Picture.FirstOrDefault(p => p.Id == Id).Likes);
     }
 }
 public Picture GetPictureById(int Id)
 {
     using (var context = new PictureContext(_connectionString))
     {
         return(context.Picture.FirstOrDefault(p => p.Id == Id));
     }
 }
 public List <Picture> GetPictures()
 {
     using (var context = new PictureContext(_connectionString))
     {
         return(context.Picture.OrderBy(p => p.Date).ToList());
     }
 }
 public void AddLike(int Id)
 {
     using (var context = new PictureContext(_connectionString))
     {
         context.Picture.FirstOrDefault(p => p.Id == Id).Likes++;
         context.SaveChanges();
     }
 }
 public void AddPicture(Picture picture)
 {
     using (var context = new PictureContext(_connectionString))
     {
         context.Picture.Add(picture);
         context.SaveChanges();
     }
 }