public ActionResult DeleteConfirmed(int id) { Temat temat = db.Tematy.Find(id); db.Tematy.Remove(temat); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Temat temat = db.Tematy.Find(id); if (temat == null) { return(HttpNotFound()); } return(View(temat)); }
public ActionResult Create([Bind(Include = "IdTematu,Tytul,Tresc,DataDodania,IdKategorii,Id")] Temat temat) { if (ModelState.IsValid) { temat.DataDodania = System.DateTime.Now; temat.Id = User.Identity.GetUserId(); db.Tematy.Add(temat); db.SaveChanges(); return(RedirectToAction("../Home")); } ViewBag.IdKategorii = new SelectList(db.Kategorie, "IdKategorii", "NazwaKategorii", temat.IdKategorii); ViewBag.Id = new SelectList(db.Users, "Id", "Email", temat.Id); return(View(temat)); }
// GET: Komentarz/Create public ActionResult Create(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Temat temat = db.Tematy.Find(id); ViewBag.Tytul = temat.Tytul; ViewBag.Id = id; /* * ViewBag.IdTekstu = new SelectList(db.Teksty, "IdTekstu", "Tytul"); * ViewBag.Id = new SelectList(db.Users, "Id", "Email"); */ return(View()); }
public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Temat temat = db.Tematy.Find(id); Komentarz komentarz = db.Komentarze.Find(id); if (temat == null) { return(HttpNotFound()); } var model = new MultidateTematKomentarz() { temat = temat, komentarz1 = komentarz }; model.komentarz = db.Komentarze.ToList(); return(View(model)); }