예제 #1
0
 public void Add(Site Site)
 {
     using (var context = new WebsitePerfomanceDbContext())
     {
         context.Sites.Add(Site);
         context.SaveChanges();
     }
 }
예제 #2
0
        public void UpdateSite(List <TestingPage> pagesSite, int id)
        {
            using (var context = new WebsitePerfomanceDbContext())
            {
                var currentSite = context.Sites.Include(s => s.Pages.Select(p => p.Speeds)).FirstOrDefault(x => x.Id == id);

                for (int i = 0; i < pagesSite.Count; i++)
                {
                    currentSite.Pages[i] = pagesSite[i];
                    pagesSite[i].Site    = currentSite;
                }

                context.SaveChanges();
            }
        }