public ActionResult Edit([Bind(Include = "MaTuyen,DiemDi,DiemDen,QuangDuong,ThoiGian,SoChuyen1Ngay,createUser,lastupdateUser,createDate,lastupdateDate,isDeleted")] TUYENXE tUYENXE) { string thuocTinhThanh = Request.Form["tinhThanhDropList"].ToString(); string thuocTinhThanh1 = Request.Form["tinhThanhDropList1"].ToString(); if (thuocTinhThanh != thuocTinhThanh1) { if (ModelState.IsValid) { ITinhThanhService tinhThanhService = new TinhThanhService(); TINHTHANH tt = tinhThanhService.Detail(thuocTinhThanh); TINHTHANH tt1 = tinhThanhService.Detail(thuocTinhThanh1); IList <TUYENXE> tuyen = service.Detail(tUYENXE.MaTuyen); tuyen[0].DiemDi = thuocTinhThanh; tuyen[0].DiemDen = thuocTinhThanh1; tuyen[0].QuangDuong = tUYENXE.QuangDuong; tuyen[0].ThoiGian = tUYENXE.ThoiGian; tuyen[0].SoChuyen1Ngay = tUYENXE.SoChuyen1Ngay; tuyen[0].TINHTHANH = tt; tuyen[0].TINHTHANH = tt1; service.Update(tuyen[0]); return(RedirectToAction("Index")); } } else { return(RedirectToAction("Index")); } return(View(tUYENXE)); }
public ActionResult Edit([Bind(Include = "MaTram,TenTram,MaTT,DiaChi,MoTa,createUser,lastupdateUser,createDate,lastupdateDate,isDeleted")] TRAMXE tRAMXE) { string thuocTinhThanh = Request.Form["tinhThanhDropList"].ToString(); if (ModelState.IsValid) { ITinhThanhService tinhThanhService = new TinhThanhService(); TINHTHANH tt = tinhThanhService.Detail(thuocTinhThanh); IList <TRAMXE> tram = service.Detail(tRAMXE.MaTram); tram[0].MaTT = thuocTinhThanh; tram[0].TenTram = tRAMXE.TenTram; tram[0].DiaChi = tRAMXE.DiaChi; tram[0].MoTa = tRAMXE.MoTa; tram[0].TINHTHANH = tt; service.Update(tram[0]); return(RedirectToAction("Index")); } return(View(tRAMXE)); }