public ActionResult CreateRepuestoOrden([Bind(Include = "idOrdenTrabajo,idRepuesto,cantidadHs,cantidadRepuesto")] RepuestoOrden repuestoOrden) { if (ModelState.IsValid) { db.RepuestoOrden.Add(repuestoOrden); db.SaveChanges(); return(RedirectToAction("IndexEmpleado")); } ViewBag.idRepuesto = new SelectList(db.Repuesto, "idRepuesto", "nombre"); return(View(repuestoOrden)); }
public ActionResult CreateRepuestoOrden(int?id) { if (id != null) { OrdenTrabajo ordentrabajo = db.OrdenTrabajo.Find(id); RepuestoOrden repuestoOrden = new RepuestoOrden(); repuestoOrden.idOrdenTrabajo = ordentrabajo.idOrdenTrabajo; ViewBag.idRepuesto = new SelectList(db.Repuesto, "idRepuesto", "nombre"); return(View(repuestoOrden)); } return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); /* * <div class="form-group"> * @Html.LabelFor(model => model.idOrdenTrabajo, "idOrdenTrabajo", htmlAttributes: new { @class = "control-label col-md-2" }) * <div class="col-md-10"> * @Html.DropDownList("idOrdenTrabajo", null, htmlAttributes: new { @class = "form-control" }) * @Html.ValidationMessageFor(model => model.idOrdenTrabajo, "", new { @class = "text-danger" }) * </div> * </div> */ }