public List <Models.MViewModels.MViewOrderDetails> GetAllDetails(int OrderId) { List <Models.MViewModels.MViewOrderDetails> OrderDetails = new List <Models.MViewModels.MViewOrderDetails>(); List <Models.MOrdersLine> OrderLine = new List <Models.MOrdersLine>(); Models.MViewModels.MViewOrderDetails mvo = new Models.MViewModels.MViewOrderDetails(); Classes.COrderOnline coo = new COrderOnline(); Classes.COrders co = new COrders(); Classes.CProducts cp = new CProducts(); OrderLine = coo.GetAll(); OrderLine = OrderLine.Where(o => o.OrderId == OrderId.ToString()).ToList(); for (int i = 0; i < OrderLine.Count; i++) { mvo = new Models.MViewModels.MViewOrderDetails(); string CurrentProductPrice = string.Empty, ProductName = string.Empty; ProductName = cp.GetProductNameWithTagsById(Convert.ToInt32(OrderLine[i].ProductId)); string OrderType = co.ReturnOrderTypeById(OrderId); switch (OrderType) { case "Client": { CurrentProductPrice = cp.ReturnSalePrice(Convert.ToInt32(OrderLine[i].ProductId)); break; } case "Vendor": { CurrentProductPrice = cp.ReturnCostPrice(Convert.ToInt32(OrderLine[i].ProductId)); break; } default: break; } mvo.CurrentProductPrice = CurrentProductPrice; mvo.OrderProductPrice = OrderLine[i].SalePrice; mvo.ProductCost = OrderLine[i].totalProductCost; mvo.ProductName = ProductName; mvo.Units = OrderLine[i].unit; OrderDetails.Add(mvo); } return(OrderDetails); }