public ActionResult Edit([Bind(Include = "id,idtour,ngaykhoihanh,ngayketthuc,chuongtrinhthamquan,tendoan")] doandulich doandulich, [Bind(Prefix = "ct")] chitietdoandulich[] ct) { if (ModelState.IsValid) { ddlbus.update(doandulich, ct); return(RedirectToAction("Index")); } ViewBag.idkhachhang = new SelectList(ddlbus.listkh(), "id", "socmnd_tenkh"); ViewBag.idtour = new SelectList(ddlbus.db1.GetAll(), "id", "tentour", doandulich.idtour); doandulichviewmodel ddlvm = new doandulichviewmodel(); doandulich.chitietdoandulich = ct; ddlvm.doandulich = doandulich; return(View(ddlvm)); }
// GET: doanduliches/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } doandulich doandulich = ddlbus.db.First(c => c.id == id); if (doandulich == null) { return(HttpNotFound()); } ViewBag.idkhachhang = new SelectList(ddlbus.listkh(), "id", "socmnd_tenkh"); ViewBag.idtour = new SelectList(ddlbus.db1.GetAll(), "id", "tentour", doandulich.idtour); doandulichviewmodel ddlvm = new doandulichviewmodel(); ddlvm.doandulich = doandulich; return(View(ddlvm)); }