public ActionResult SuaBaiViet(PostingModel model) { BaiViet bv = db.BaiViets.Find(model.idBV); NhaTro nt = db.NhaTroes.Find(bv.idNT); bv.TieuDe = model.TieuDe; bv.TieuDePhu = model.TieuDePhu; bv.MoTa = model.MoTa; nt.SoNha = model.SoNha; nt.Gia = model.Gia; nt.Lau = model.Lau; nt.idPhuong = model.idPhuong; nt.idQuan = model.idQuan; nt.PhongNgu = model.PhongNgu; nt.NhaTam = model.NhaTam; var bvdao = new BaiVietDAO(); bvdao.Update(bv); var ntdao = new NhaTroDAO(); int idnt = (int)bv.idNT; ntdao.Update(nt, idnt); return(RedirectToAction("PostsManager", "Posting")); }
public ActionResult SuaBaiViet(DetailModel model) { var bv = db.BaiViets.Find(model.idBV); var nt = new NhaTroDAO().GetByID(bv.idNT); bv.TieuDe = model.tieude; bv.TieuDePhu = model.tieudephu; bv.MoTa = model.mota; nt.Lau = model.lau; nt.NhaTam = model.nhatam; nt.PhongNgu = model.phongngu; nt.DienTich = model.dientich; var bvdao = new BaiVietDAO(); bvdao.Update(bv); var ntdao = new NhaTroDAO(); int idnt = (int)bv.idNT; ntdao.Update(nt, idnt); return(RedirectToAction("QLBV", "Home")); }