Esempio n. 1
0
 public IEnumerable <UploadedPicture> UsersPictures(int id)
 {
     using (var context = new PicturesDBDataContext(_connection))
     {
         return(context.UploadedPictures.Where(u => u.id == id).ToList());
     }
 }
Esempio n. 2
0
 public void delete(int id)
 {
     using (var context = new PicturesDBDataContext(_connection))
     {
         context.ExecuteCommand("delete from UploadedPictures where id = {0}", id);
     }
 }
Esempio n. 3
0
 public User GetUser(string email)
 {
     using (var context = new PicturesDBDataContext(_connection))
     {
         return(context.Users.FirstOrDefault(u => u.Email == email));
     }
 }
Esempio n. 4
0
        public UploadedPicture GetPic(int id)
        {
            using (var context = new PicturesDBDataContext(_connection))

            {
                return(context.UploadedPictures.FirstOrDefault(i => i.id == id));
            }
        }
Esempio n. 5
0
 public void Add(UploadedPicture picture)
 {
     using (var context = new PicturesDBDataContext(_connection))
     {
         context.UploadedPictures.InsertOnSubmit(picture);
         context.SubmitChanges();
     }
 }
Esempio n. 6
0
 public void TimesSeen(int id)
 {
     using (var context = new PicturesDBDataContext(_connection))
     {
         UploadedPicture image = context.UploadedPictures.FirstOrDefault(i => i.id == id);
         image.TimesSeen = image.TimesSeen + 1;
         context.SubmitChanges();
     }
 }
Esempio n. 7
0
 public User GetUser(string email, string password)
 {
     using (var context = new PicturesDBDataContext(_connection))
     {
         User user    = context.Users.FirstOrDefault(u => u.Email == email);
         bool correct = PasswordHelper.PasswordMatch(password, user.PasswordSalt, user.PasswordHash);
         if (correct)
         {
             return(user);
         }
         return(null);
     }
 }