コード例 #1
0
 public void UpdatePhotoUrls()
 {
     using (InstagramEntities db = new InstagramEntities())
     {
         for (int i = 0; i < 257; i++)
         {
             photos photo = db.photos.Where(s => s.id == i + 1).FirstOrDefault();
             photo.image_url = "https://picsum.photos/id/" + i + "/500/580";
             db.SaveChanges();
         }
     }
 }
コード例 #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            using (InstagramEntities db = new InstagramEntities())
            {
                var qury = from st in db.users
                           select st;

                List <users> allUsers = qury.ToList <users>();
                foreach (var v in allUsers)
                {
                    UserNameListBox.Items.Add(v.username);
                }

                UserNameListBox.SetSelected(0, true);

                //Added in order to update Photos table image_url values:
                DBUpdater updater = new DBUpdater();
                updater.UpdatePhotoUrls();
            }
        }