public void UpdatePicture(DalPicture picture)
 {
     if (_context == null)
         throw new NullReferenceException("repository");
     if (picture == null)
         return ;
     if (GetCurrentUserId() == picture.UserId)
     {
         _context.Entry(picture.ToPictures()).State = EntityState.Modified;
         _context.SaveChanges();
     }
 }
 public void CreatePicture(DalPicture picture, string email)
 {
     if (_context == null)
         throw new NullReferenceException("repository");
     picture.UserId = _context.Set<Users>().Single(u => u.Email == email).Id;
     _context.Set<Pictures>().Add(picture.ToPictures());
     _context.SaveChanges();
 }