public ActionResult DeleteConfirmed(int id) { poruka poruka = db.porukas.Find(id); db.porukas.Remove(poruka); db.SaveChanges(); return(RedirectToAction("Index", "")); }
public ActionResult Edit([Bind(Include = "idporuka,temaPoruke,tijeloPoruke,datumPoruke,posiljateljPoruke")] poruka poruka) { if (ModelState.IsValid) { db.Entry(poruka).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", "")); } return(View(poruka)); }
public ActionResult Create([Bind(Include = "idporuka,temaPoruke,tijeloPoruke,datumPoruke,posiljateljPoruke")] poruka poruka) { if (ModelState.IsValid) { int noviId = (from st in db.porukas select st).Max(x => x.idporuka) + 1; poruka.idporuka = noviId; db.porukas.Add(poruka); db.SaveChanges(); return(RedirectToAction("poslano", "porukas")); } return(View(poruka)); }
// GET: porukas/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } poruka poruka = db.porukas.Find(id); if (poruka == null) { return(HttpNotFound()); } return(View(poruka)); }