public ActionResult Create([Bind(Include = "concepto,numDocumento,proveedor,monto")] costosHojaRuta costosHojaRuta) { if (Session["Login"] == null) { return(RedirectToAction("Login", "Home")); } else { int id = Convert.ToInt32(TempData["id"]); TempData["id"] = id; if (ModelState.IsValid) { costosHojaRuta.idHojaRuta = id; costosHojaRuta.fecha = DateTime.Now; db.costosHojaRuta.Add(costosHojaRuta); db.SaveChanges(); TempData["Alerta"] = "Costo Agregado"; return(RedirectToAction("Index")); } ViewBag.idHojaRuta = new SelectList(db.hojaRuta, "idHojaRuta", "patente", costosHojaRuta.idHojaRuta); return(View(costosHojaRuta)); } }
public ActionResult DeleteConfirmed(int id) { if (Session["Login"] == null) { return(RedirectToAction("Login", "Home")); } else { costosHojaRuta costosHojaRuta = db.costosHojaRuta.Find(id); db.costosHojaRuta.Remove(costosHojaRuta); db.SaveChanges(); return(RedirectToAction("Index")); } }
public ActionResult Edit([Bind(Include = "idCosto,idHojaRuta,concepto,numDocumento,proveedor,monto,fecha")] costosHojaRuta costosHojaRuta) { if (Session["Login"] == null) { return(RedirectToAction("Login", "Home")); } else { if (ModelState.IsValid) { db.Entry(costosHojaRuta).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.idHojaRuta = new SelectList(db.hojaRuta, "idHojaRuta", "patente", costosHojaRuta.idHojaRuta); return(View(costosHojaRuta)); } }
// GET: costosHojaRutas/Details/5 public ActionResult Details(int?id) { if (Session["Login"] == null) { return(RedirectToAction("Login", "Home")); } else { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } costosHojaRuta costosHojaRuta = db.costosHojaRuta.Find(id); if (costosHojaRuta == null) { return(HttpNotFound()); } return(View(costosHojaRuta)); } }
// GET: costosHojaRutas/Edit/5 public ActionResult Edit(int?id) { if (Session["Login"] == null) { return(RedirectToAction("Login", "Home")); } else { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } costosHojaRuta costosHojaRuta = db.costosHojaRuta.Find(id); if (costosHojaRuta == null) { return(HttpNotFound()); } ViewBag.idHojaRuta = new SelectList(db.hojaRuta, "idHojaRuta", "patente", costosHojaRuta.idHojaRuta); return(View(costosHojaRuta)); } }