public ActionResult Edit([Bind(Include = "id,ime")] zadruge zadruge) { if (ModelState.IsValid) { db.Entry(zadruge).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(zadruge)); }
public ActionResult Create([Bind(Include = "id,ime")] zadruge zadruge) { if (ModelState.IsValid) { db.zadruge.Add(zadruge); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(zadruge)); }
// GET: zadruge/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } zadruge zadruge = db.zadruge.Find(id); if (zadruge == null) { return(HttpNotFound()); } return(View(zadruge)); }
// GET: zadruge/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } zadruge zadruge = db.zadruge.Find(id); if (zadruge == null) { return(HttpNotFound()); } ViewData["Clanovi"] = db.gospodarstva.Where(g => g.zadruge.id == id).ToList(); return(View(zadruge)); }
public ActionResult DeleteConfirmed(int id) { zadruge zadruge = db.zadruge.Find(id); try { db.zadruge.Remove(zadruge); db.SaveChanges(); } catch { return(View("Error")); } return(RedirectToAction("Index")); }