Home » c# » c# – How to make a "JOIN"

c# – How to make a "JOIN"

Posted by: admin February 21, 2020 Leave a comment

Questions:

I am working with this section of code and they asked me to make some modifications

What I have to do is a “JOIN” but I really don’t know this very well, I already looked on the web but I see that they program it differently

public IList<Web_INCAEntities> GetAll()
    {
        var result = HttpContext.Current.Session["Products"] as IList<Web_INCAEntities>;

        if (result == null || UpdateDatabase)
        {
            result = entities.Cat_Cuenta_Recurso.Select(product => new Cat_Cuenta_Recurso 
            {
                Id = product.Id,
                Descripcion = product.Descripcion,
                UnitPrice = product.UnitPrice.HasValue ? product.UnitPrice.Value : default(decimal),
                UnitsInStock = product.UnitsInStock.HasValue ? product.UnitsInStock.Value : default(short),
                QuantityPerUnit = product.QuantityPerUnit,
                Discontinued = product.Discontinued,
                UnitsOnOrder = product.UnitsOnOrder.HasValue ? (int)product.UnitsOnOrder.Value : default(int),
                CategoryID = product.CategoryID,
                Category = new CategoryViewModel()
                {
                    CategoryID = product.Category.CategoryID,
                    CategoryName = product.Category.CategoryName
                },
                LastSupply = DateTime.Today
            }).ToList();

            HttpContext.Current.Session["Products"] = result;
        }

        return result;
    }

With the table I want to make “JOIN” I already add it to my EntityFramework

How to&Answers: