Exemplo n.º 1
0
        public List <OperatorEN> GetOperatorProducts(int pCountryID)
        {
            List <OperatorEN> operatorsList = new List <OperatorEN>();

            try
            {
                operatorsList = operatorDAL.GetOperatorsYCR(pCountryID);

                var products = productDAL.GetProductsByCountryID(pCountryID);

                foreach (var ope in operatorsList)
                {
                    ope.Products = new List <ProductEN>();

                    var operatorProducts = products.Where(p => p.OperatorID == ope.OperatorID).ToList();;

                    foreach (var prod in operatorProducts)
                    {
                        ope.Products.Add(prod);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.InnerException);
                EventViewerLoggerBL.LogError("GetOperatorProducts: " + ex.Message);
            }

            return(operatorsList);
        }