// GET: WoDetails/Edit/5 public ActionResult Edit(int?id) { /*var workorders = db.WoDetails.SingleOrDefault(c => c.WoDetailId == id); * * var productives = db.Productives.ToList(); * var woresponsible = db.WoResponsibles.ToList(); * * var viewModel = new SaveWoDetailViewModel() * { * * Productives = productives, * WoResponsibles = woresponsible, * * };*/ if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } WoDetail woDetail = db.WoDetails.Find(id); if (woDetail == null) { return(HttpNotFound()); } ViewBag.WorkOrderId = new SelectList(db.WorkOrders, "WorkOrderId", "WorkOrderId", woDetail.WorkOrderId); return(View(woDetail)); }
public ActionResult DeleteConfirmed(int id) { WoDetail woDetail = db.WoDetails.Find(id); db.WoDetails.Remove(woDetail); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "WoDetailId,WorkDate,WoResponsible,Objective,StartTime,FinishTime,TotalTime,Risk,RiskAction,Productive,Notes,WorkOrderId")] WoDetail woDetail) //public ActionResult Edit(WoDetail woDetail) { if (ModelState.IsValid) { db.Entry(woDetail).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("WoDetails", "WoDetails")); } ViewBag.WorkOrderId = new SelectList(db.WorkOrders, "WorkOrderId", "WorkOrderId", woDetail.WorkOrderId); return(View(woDetail)); }
// GET: WoDetails/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } WoDetail woDetail = db.WoDetails.Find(id); if (woDetail == null) { return(HttpNotFound()); } return(View(woDetail)); }