public Boolean themDia(eDiaCD eDia) { tbDiaCD tbDia = new tbDiaCD(); tbDia.MaDiaCD = eDia.MaDiaCD; tbDia.TinhTrangDia = eDia.TinhTrang; tbDia.MaTieuDe = eDia.MaTieuDe; db.tbDiaCDs.InsertOnSubmit(tbDia); db.SubmitChanges(); return(true); }
public Boolean xoaDia(String ma) { tbDiaCD tbDia = (from x in db.tbDiaCDs where x.MaDiaCD.Equals(ma) select x).FirstOrDefault(); if (tbDia != null) { db.tbDiaCDs.DeleteOnSubmit(tbDia); db.SubmitChanges(); return(true); } return(false); }
//public List<eLoaiDia> getALLLoaiDia() //{ // var dstam = db.tbLoaiDias.ToList(); // List<eLoaiDia> lsLoaiDia = new List<eLoaiDia>(); // foreach (tbLoaiDia tam in dstam) // { // eLoaiDia loaidia = new eLoaiDia(); // loaidia.MaLoai = tam.MaLoai; // loaidia.TenLoai = tam.TenLoai; // loaidia.ThoiGianThue = (int)tam.ThoiGianThue; // loaidia.Gia = (decimal)tam.Gia; // lsLoaiDia.Add(loaidia); // } // return lsLoaiDia; //} //public List<eDiaCD> getALLDiaTheoTieuDe(string maTieuDe) //{ // var dstam = db.tbDiaCDs.Where(x => x.MaTieuDe.Equals(maTieuDe)).ToList(); // List<eDiaCD> lsDiaCD = new List<eDiaCD>(); // foreach (tbDiaCD tam in dstam) // { // eDiaCD diacd = new eDiaCD(); // diacd.MaDiaCD = tam.MaDiaCD; // diacd.TinhTrang = tam.TinhTrangDia; // diacd.MaDiaCD = tam.MaDiaCD; // lsDiaCD.Add(diacd); // } // return lsDiaCD; //} //----Nguyễn Lê Ngân Bình ----// //Lấy đĩa bằng mã đĩa public eDiaCD layDiaBangMaDia(string maDiaCD) { tbDiaCD diaCD = (from n in db.tbDiaCDs where n.MaDiaCD.Equals(maDiaCD) select n).FirstOrDefault(); if (diaCD != null) { eDiaCD diaCDCustom = new eDiaCD(); diaCDCustom.MaDiaCD = diaCD.MaDiaCD; diaCDCustom.TinhTrang = diaCD.TinhTrangDia; diaCDCustom.MaTieuDe = diaCD.MaTieuDe; return(diaCDCustom); } else { return(null); } }