public ActionResult Edit([Bind(Include = "id,fecha,litros,lecheria_id,jornada")] ordena ordena) { if (ModelState.IsValid) { db.Entry(ordena).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.lecheria_id = new SelectList(db.lecheria, "id", "id", ordena.lecheria_id); return(View(ordena)); }
public ActionResult Create([Bind(Include = "id,fecha,litros,lecheria_id,jornada")] ordena ordena) { if (ModelState.IsValid) { db.ordena.Add(ordena); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.lecheria_id = new SelectList(db.lecheria, "id", "id", ordena.lecheria_id); return(View(ordena)); }
// GET: Ordena/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ordena ordena = db.ordena.Find(id); if (ordena == null) { return(HttpNotFound()); } return(View(ordena)); }
// GET: Ordena/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ordena ordena = db.ordena.Find(id); if (ordena == null) { return(HttpNotFound()); } ViewBag.lecheria_id = new SelectList(db.lecheria, "id", "id", ordena.lecheria_id); return(View(ordena)); }
public ActionResult DeleteConfirmed(int id) { ordena ordena = db.ordena.Find(id); try { db.ordena.Remove(ordena); db.SaveChanges(); return(RedirectToAction("Index")); } catch { ViewBag.Error = "No se puede eliminar debido a que existen datos asociados"; } return(View(ordena)); }