public ActionResult Create(PhongThaoLuan phong) { //phong.TenPhong phong.NgayTao = DateTime.Now; phong.TrangThai = true; Service.PhongThaoLuans.Add(phong); Service.SaveChanges(); return(RedirectToAction("Index", "PhongChat")); }
public ActionResult Edit(PhongThaoLuan phong) { //Service.Entry(phong).State = System.Data.Entity.EntityState.Modified; var phong_old = Service.PhongThaoLuans.FirstOrDefault(ph => ph.id == phong.id); phong_old.TenPhong = phong.TenPhong; phong_old.id_LoaiPhongThaoLuan = phong.id_LoaiPhongThaoLuan; Service.SaveChanges(); return(RedirectToAction("Index", "PhongChat")); }