Esempio n. 1
0
 static WorkWithContext()
 {
     Models.Context context = new Models.Context();
     context.Respons.Add(new Models.Respons()
     {
         Name = "EEEE", Date = System.DateTime.Today, Row = "Egejhbf ekhbtve hjgberg rnb bghutbg erhtb gthrbg rthgb rthg rhgr thirsefjerhg srkths "
     });
     context.SaveChanges();
 }
Esempio n. 2
0
        static public void AddArticle(Models.Article article, int[] Id)
        {
            Models.Context context = new Models.Context();
            context.Articles.Add(article);
            context.SaveChanges();
            Models.Article art = context.Articles.Find(article.Id);
            //Models.Context context2 = new Models.Context();
            IEnumerable <Models.Teg> tags = context.Tegs.ToList();

            foreach (var item in tags)
            {
                for (int i = 0; i < Id.Length; i++)
                {
                    if (item.Id == Id[i])
                    {
                        art.Tegs.Add(item);
                    }
                }
            }
            context.Entry(art).State = EntityState.Modified;
            context.SaveChanges();
        }
Esempio n. 3
0
 static public void SendForm(Models.Form form)
 {
     Models.Context context = new Models.Context();
     context.Forms.Add(form);
     context.SaveChanges();
 }
Esempio n. 4
0
 static public void SendRespons(Models.Respons respons)
 {
     Models.Context context = new Models.Context();
     context.Respons.Add(respons);
     context.SaveChanges();
 }