public IEnumerable <UploadedPicture> UsersPictures(int id) { using (var context = new PicturesDBDataContext(_connection)) { return(context.UploadedPictures.Where(u => u.id == id).ToList()); } }
public void delete(int id) { using (var context = new PicturesDBDataContext(_connection)) { context.ExecuteCommand("delete from UploadedPictures where id = {0}", id); } }
public User GetUser(string email) { using (var context = new PicturesDBDataContext(_connection)) { return(context.Users.FirstOrDefault(u => u.Email == email)); } }
public UploadedPicture GetPic(int id) { using (var context = new PicturesDBDataContext(_connection)) { return(context.UploadedPictures.FirstOrDefault(i => i.id == id)); } }
public void Add(UploadedPicture picture) { using (var context = new PicturesDBDataContext(_connection)) { context.UploadedPictures.InsertOnSubmit(picture); context.SubmitChanges(); } }
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(); } }
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); } }