//Sửa phòng public int updatePhong(PhongDTO pDTO) { try { var querry = (from p in htDataContext.phongs where p.maphong == pDTO.Maphong select p).FirstOrDefault<phong>(); querry.maloai = pDTO.Maloai; querry.dadat = pDTO.Dadat; querry.danhan = pDTO.Danhan; htDataContext.SubmitChanges(); return 1; } catch { return 0; } }
//Thêm phòng public int insertPhong(PhongDTO pDTO) { try { phong p = new phong(); p.maphong = pDTO.Maphong; p.maloai = pDTO.Maloai; p.dadat = (bool)pDTO.Dadat; p.danhan = (bool)pDTO.Danhan; htDataContext.phongs.InsertOnSubmit(p); htDataContext.SubmitChanges(); return 1; } catch { return 0; } }