Any Expert can resolve this problem.
- public class productviewModel
- {
- public Product listProducts { get; set; }
- public List
listProductDetails { get; set; } - }
function
- public ProductViewModel GetProductByID(int ID)
- {
- ProductViewModel listprod = new ProductViewModel();
- try
- {
- var productsl = (from p in _db.Products
- where p.ProductID == ID
- select new
- {
- p.PName,
- p.PDescription,
- p.Model,
- p.Condition,
- p.UnitPrice,
- p.ManificturedPrice,
- p.Discount,
- p.UnitWeight,
- p.UnitInStock
- }).FirstOrDefault();
- var productD = (from pd in _db.ProductDetails
- join b in _db.Products on pd.ProductID equals b.ProductID
- where pd.ProductID == ID
- select new
- {
- pd.ProductID,
- pd.OS,
- pd.ProcessorType,
- pd.RAM,
- pd.ScreenSize,
- pd.TouchScreen,
- pd.BatteryLife,
- pd.Camera
- }).ToList();
- listprod.listProducts = productsl;
- listprod.listProductDetails = productD;
- return listprod;
- }
- catch (Exception)
- {
- throw;
- }
- }
productsl

productD

Amit MohantyPosted Mar 2, 2020, 3:02 AM
Ravi PatelPosted Mar 2, 2020, 3:11 AM