public bool CapNhap(ThongSoKyThuat_OBJ obj) { try { MayTinhDbContext db = new MayTinhDbContext(); Base.ThongSoKyThuat item = MapperBase(obj); db.Entry(item).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(true); } catch { return(false); } }
public ThongSoKyThuat_OBJ Xoa(int MaSanPham, int MaMay) { MayTinhDbContext db = new MayTinhDbContext(); Base.ThongSoKyThuat item = ( from items in db.ThongSoKyThuats where items.MaSanPham == MaSanPham && items.MaMay == MaMay select items).SingleOrDefault(); if (item == null) { return(null); } db.ThongSoKyThuats.Remove(item); db.SaveChanges(); return(Mapper(item)); }
public Base.ThongSoKyThuat MapperBase(ThongSoKyThuat_OBJ obj) { SanPham.SanPham_BUS bus = new SanPham.SanPham_BUS(); Base.ThongSoKyThuat item = new Base.ThongSoKyThuat() { MaMay = obj.MaMay, MaSanPham = obj.MaSanPham, CacManHinh = obj.CacManHinh, CongKetNoi = obj.CongKetNoi, KichThuoc = obj.KichThuoc, HeDieuHanh = obj.HeDieuHanh, CPU = obj.CPU, ManHinh = obj.ManHinh, HienThi = obj.HienThi, Ram = obj.Ram, OCung = obj.OCung, }; return(item); }
public ThongSoKyThuat_OBJ Mapper(Base.ThongSoKyThuat item) { SanPham.SanPham_BUS bus = new SanPham.SanPham_BUS(); ThongSoKyThuat_OBJ obj = new ThongSoKyThuat_OBJ() { MaMay = item.MaMay, MaSanPham = item.MaSanPham, CacManHinh = item.CacManHinh, CongKetNoi = item.CongKetNoi, KichThuoc = item.KichThuoc, HeDieuHanh = item.HeDieuHanh, CPU = item.CPU, ManHinh = item.ManHinh, HienThi = item.HienThi, Ram = item.Ram, OCung = item.OCung, SanPham = bus.Mapper(item.SanPham) }; return(obj); }