상속: INotifyPropertyChanging, INotifyPropertyChanged
예제 #1
0
        public int DodajPost(string tytul, string tresc, int status, string tagi, string opis)
        {
            using (LinqTodbBlogDataContext context = new LinqTodbBlogDataContext())
            {
                Posty p = new Posty
                {
                    tytul            = tytul,
                    tresc            = tresc,
                    status           = status,
                    data_dodania     = DateTime.Now,
                    data_modyfikacji = DateTime.Now,
                };
                context.Posties.InsertOnSubmit(p);
                context.SubmitChanges();

                Tagi t = new Tagi
                {
                    id_posta    = p.id,
                    keywords    = tagi,
                    description = opis
                };

                context.Tagis.InsertOnSubmit(t);
                context.SubmitChanges();

                return(p.id);
            }
        }
예제 #2
0
파일: TagDAL.cs 프로젝트: d3dek/AwesomeBlog
        public void DodajTag(int idPosta, string keywords, string desc)
        {
            using (LinqTodbBlogDataContext context = new LinqTodbBlogDataContext())
            {
                Tagi t = new Tagi
                {
                    id_posta    = idPosta,
                    keywords    = keywords,
                    description = desc
                };

                context.Tagis.InsertOnSubmit(t);
                context.SubmitChanges();
            }
        }
예제 #3
0
        public int dodajPost(Models.PostTagModel model)
        {
            using (LinqTodbBlogDataContext db = new LinqTodbBlogDataContext())
            {
                try
                {
                    Posty p = new Posty
                    {
                        tytul            = model.Tytul,
                        tresc            = model.Tresc,
                        data_dodania     = DateTime.Now,
                        data_modyfikacji = DateTime.Now,
                        status           = model.Status
                    };

                    db.Posties.InsertOnSubmit(p);
                    db.SubmitChanges();

                    Tagi t = new Tagi
                    {
                        description = model.Desc,
                        keywords    = model.Keywords,
                        id_posta    = p.id
                    };

                    db.Tagis.InsertOnSubmit(t);
                    db.SubmitChanges();

                    return(p.id);
                }
                catch (Exception)
                {
                    return(0);
                    /*throw new Exception("Wystąpił błąd podczas dodawania nowego postu");*/
                }
            }
        }
예제 #4
0
        public int dodajPost(Models.PostTagModel model)
        {
            using (LinqTodbBlogDataContext db = new LinqTodbBlogDataContext())
            {
                try
                {
                    Posty p = new Posty
                    {
                        tytul = model.Tytul,
                        tresc = model.Tresc,
                        data_dodania = DateTime.Now,
                        data_modyfikacji = DateTime.Now,
                        status = model.Status
                    };

                    db.Posties.InsertOnSubmit(p);
                    db.SubmitChanges();

                    Tagi t = new Tagi
                    {
                        description = model.Desc,
                        keywords = model.Keywords,
                        id_posta = p.id
                    };

                    db.Tagis.InsertOnSubmit(t);
                    db.SubmitChanges();

                    return p.id;
                }
                catch (Exception)
                {
                    return 0;
                    /*throw new Exception("Wystąpił błąd podczas dodawania nowego postu");*/
                }
            }
        }
예제 #5
0
 partial void DeleteTagi(Tagi instance);
예제 #6
0
 partial void UpdateTagi(Tagi instance);
예제 #7
0
 partial void InsertTagi(Tagi instance);
예제 #8
0
 partial void DeleteTagi(Tagi instance);
예제 #9
0
 partial void UpdateTagi(Tagi instance);
예제 #10
0
 partial void InsertTagi(Tagi instance);