private static Product ConvertProduct(ServiceProduct.product myProduct) { Product p = new Product(); p.id = myProduct.id; p.id_manufacturer = myProduct.id_manufacturer; p.id_save = myProduct.id_save; p.manufacturer = sManu.GetManufacturerById(myProduct.id_manufacturer).name; var s = sSave.GetSaveWithId(myProduct.id_save); p.save = s.percent_save; p.name_save = s.name; p.name = myProduct.name; p.product_info = myProduct.product_info; p.sale_price = myProduct.sale_price; p.number = myProduct.number; p.image = myProduct.image; return(p); }
public static void Insert(ServiceProduct.product sp) { sProduct.AddProduct(sp); }
public static void Update(ServiceProduct.product sp) { sProduct.UpdateProduct(sp); }
public static Product GetSanPhamByMaSP(int id) { ServiceProduct.product p = sProduct.GetProductById(id); return(ConvertProduct(p)); }