public ActionResult UpdateDuAn(EntityCapNhatDuAn duan) { EntityDuAn DA = db.EntityDuAns.Where(g => g.Id == duan.IdDuAn).FirstOrDefault(); try { EntityCapNhatDuAn capnhat = new EntityCapNhatDuAn(); capnhat.NoiDung = duan.NoiDung; capnhat.IdDuAn = duan.IdDuAn; capnhat.TieuDe = duan.TieuDe; capnhat.TrangThai = 0; capnhat.ThoiGian = DateTime.Now; db.EntityCapNhatDuAns.InsertOnSubmit(capnhat); db.SubmitChanges(); } catch { } return RedirectToAction("ChiTietDuAn", "DuAn", new { Title = Utilities.Paste_Int64(Utilities.Encode(DA.TenDuAn), DA.Id) }); // return View(duan); }
public ActionResult UpdateDuAn(int IdDuAn) { EntityDuAn duan = db.EntityDuAns.Where(g => g.Id == IdDuAn).FirstOrDefault(); ViewBag.duan = duan; EntityCapNhatDuAn capnhat = new EntityCapNhatDuAn(); capnhat.IdDuAn = IdDuAn; return View(capnhat); }