public ActionResult Edit([Bind(Include = "MaHD,NgayLap,GiaThoaThuan,MaTram,ThoiHanThue,MaDT,NguoiLap,MoTa,createUser,lastupdateUser,createDate,lastupdateDate,isDeleted")] HOPDONG hOPDONG) { string nguoiLap = Request.Form["nhanVienDropList"].ToString(); string doiTac = Request.Form["doiTacDropList"].ToString(); string tramXe = Request.Form["tramXeDropList"].ToString(); if (ModelState.IsValid) { INhanVienService nhanVienService = new NhanVienService(); NHANVIEN nv = nhanVienService.Detail(Int32.Parse(nguoiLap)); IDoiTacService doiTacService = new DoiTacService(); DOITAC dtac = doiTacService.Detail(Int32.Parse(doiTac)); ITramXeService tramXeService = new TramXeService(); TRAMXE tx = tramXeService.Detail(Int32.Parse(tramXe))[0]; IList <HOPDONG> hd = service.Detail(hOPDONG.MaHD); hd[0].NgayLap = hOPDONG.NgayLap; hd[0].GiaThoaThuan = hOPDONG.GiaThoaThuan; hd[0].MaTram = Int32.Parse(tramXe); hd[0].ThoiHanThue = hOPDONG.ThoiHanThue; hd[0].MaDT = Int32.Parse(doiTac); hd[0].NguoiLap = Int32.Parse(nguoiLap); hd[0].MoTa = hOPDONG.MoTa; hd[0].NHANVIEN = nv; hd[0].DOITAC = dtac; hd[0].TRAMXE = tx; service.Update(hd[0]); return(RedirectToAction("Index")); } return(View(hOPDONG)); }
public ActionResult DeleteConfirmed(int id) { TRAMXE tRAMXE = db.TRAMXEs.Find(id); db.TRAMXEs.Remove(tRAMXE); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "MaTram,TenTram,MaTT,DiaChi,MoTa,createUser,lastupdateUser,createDate,lastupdateDate,isDeleted")] TRAMXE tRAMXE) { if (ModelState.IsValid) { db.Entry(tRAMXE).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tRAMXE)); }
public ActionResult Create([Bind(Include = "MaTram,TenTram,MaTT,DiaChi,MoTa,createUser,lastupdateUser,createDate,lastupdateDate,isDeleted")] TRAMXE tRAMXE) { if (ModelState.IsValid) { db.TRAMXEs.Add(tRAMXE); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tRAMXE)); }
// GET: TRAMXEs/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TRAMXE tRAMXE = db.TRAMXEs.Find(id); if (tRAMXE == null) { return(HttpNotFound()); } return(View(tRAMXE)); }
public ActionResult Create([Bind(Include = "MaTram,TenTram,MaTT,DiaChi,MoTa,createUser,lastupdateUser,createDate,lastupdateDate,isDeleted")] TRAMXE tRAMXE) { string thuocTinhThanh = Request.Form["tinhThanhDropList"].ToString(); if (ModelState.IsValid) { tRAMXE.isDeleted = 0; tRAMXE.MaTT = thuocTinhThanh; service.Add(tRAMXE); return(RedirectToAction("Index")); } return(View(tRAMXE)); }
public void Delete(TRAMXE tram) { var user = HttpContext.Current.Session[GlobalConstant.USER]; if (user != null) { NHANVIEN currentUser = (NHANVIEN)user; tram.lastupdateUser = currentUser.MaNV; } DateTime current = DateTime.Now; tram.lastupdateDate = current; using (QLXeKhachEntities context = new QLXeKhachEntities()) { context.Entry(tram).State = EntityState.Modified; context.SaveChanges(); } }
public int Add(TRAMXE tram) { using (QLXeKhachEntities context = new QLXeKhachEntities()) { var user = HttpContext.Current.Session[GlobalConstant.USER]; if (user != null) { NHANVIEN currentUser = (NHANVIEN)user; tram.createUser = currentUser.MaNV; tram.lastupdateUser = currentUser.MaNV; } DateTime current = DateTime.Now; tram.createDate = current; tram.lastupdateDate = current; context.TRAMXEs.Add(tram); context.SaveChanges(); return(1); } }
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)); }