Blog.DAL.KomentarzDAL.DodajKomentarz C# (CSharp) Метод

DodajKomentarz() публичный Метод

public DodajKomentarz ( int idPosta, string autor, string tresc, int status ) : void
idPosta int
autor string
tresc string
status int
Результат void
        public void DodajKomentarz(int idPosta, string autor, string tresc, int status)
        {
            using (LinqTodbBlogDataContext context = new LinqTodbBlogDataContext())
            {
                Komentarze k = new Komentarze
                {
                   id_posta = idPosta,
                   autor = autor,
                   tresc = tresc,
                   status = status,
                   data_dodania = DateTime.Now
                };

                context.Komentarzes.InsertOnSubmit(k);
                context.SubmitChanges();
            }
        }