예제 #1
0
 public ActionResult Dodaj(PostTag nowy_post)
 {
     try
     {
         nowy_post.post.status = 0;
         nowy_post.post.data_dodania = DateTime.Now;
         blogDB.AddToPost(nowy_post.post);
         blogDB.SaveChanges();
         var post = blogDB.Post.Single(a => a.tresc == nowy_post.post.tresc);
         //var post = blogDB.Post.Single(a => a.data_dodania.Equals(nowy_post.post.data_dodania));
         nowy_post.tag.id_posta = post.id;
         blogDB.AddToTagi(nowy_post.tag);//pobrać id
         blogDB.SaveChanges();
         return RedirectToAction("Index");
     }
     catch
     {
         return View(nowy_post);
     }
 }
예제 #2
0
        //tagi, walidacja
        public ActionResult Dodaj()
        {
            PostTag nowy_post = new PostTag();

            return View(nowy_post);
        }