public bool DeleteCTHopDong(string soHopDong, string maSP) { try { ChiTietHopDong cthd = context.ChiTietHopDong.Single(s => s.SoHopDong.Equals(soHopDong) && s.MaSP.Equals(maSP)); context.ChiTietHopDong.Remove(cthd); context.SaveChanges(); return(true); } catch { return(false); } }
public bool UpdateCTHopDong(string soHopDong, string maSP, int soLuong, decimal?donGia) { try { ChiTietHopDong cthd = context.ChiTietHopDong.Single(s => s.SoHopDong.Equals(soHopDong) && s.MaSP.Equals(maSP)); cthd.SoLuong = soLuong; cthd.DonGia = donGia; context.SaveChanges(); return(true); } catch { return(false); } }
public bool InsertCTHopDong(ref string err, string soHopDong, string maSP, int soLuong, decimal?donGia) { try { ChiTietHopDong cthd = new ChiTietHopDong { SoHopDong = soHopDong, MaSP = maSP, SoLuong = soLuong, DonGia = donGia, }; context.ChiTietHopDong.Add(cthd); context.SaveChanges(); return(true); } catch (Exception e) { err = e.Message; return(false); } }