Ejemplo n.º 1
0
 public static void AttachToContext(UserProfile profile, SDCContext db)
 {
     if (db.Set <UserProfile>().Local.Any(local => profile == local))
     {
         db.Entry <UserProfile>(profile).State = EntityState.Unchanged;
     }
     else
     {
         db.Set <UserProfile>().Attach(profile);
         db.Entry <UserProfile>(profile).State = EntityState.Unchanged;
     }
 }
Ejemplo n.º 2
0
        public ActionResult AuthorScrapeWiki()
        {
            string baseUrl = "https://en.wikipedia.org/wiki/List_of_authors_by_name:_";
            int    updated = 0;


            //65..90
            using (var db = new SDCContext())
            {
                //load all authors
                db.Set <Author>().Load();

                for (int i = 65; i <= 90; i++)
                {
                    var url = baseUrl + (char)i;
                    Scrape(db, url, ref updated);
                }

                db.SaveChanges();
            }



            throw new NotImplementedException();
        }
Ejemplo n.º 3
0
        public ActionResult AuthorScrapeWiki()
        {
            string baseUrl = "https://en.wikipedia.org/wiki/List_of_authors_by_name:_";
            int updated = 0;

            //65..90
            using (var db = new SDCContext())
            {
                //load all authors
                db.Set<Author>().Load();

                for (int i = 65; i <= 90; i++)
                {
                    var url = baseUrl + (char)i;
                    Scrape(db, url, ref updated);
                }

                db.SaveChanges();
            }

            throw new NotImplementedException();
        }
Ejemplo n.º 4
0
 public static void AttachToContext(UserProfile profile, SDCContext db)
 {
     if (db.Set<UserProfile>().Local.Any(local => profile == local))
     {
         db.Entry<UserProfile>(profile).State = EntityState.Unchanged;
     }
     else
     {
         db.Set<UserProfile>().Attach(profile);
         db.Entry<UserProfile>(profile).State = EntityState.Unchanged;
     }
 }