linq left join with filtering in joined

c# entity-framework-6 linq

Question

Here, I'm receiving double meals.

IEnumerable<DTOHotMealsPrice> lst = (from m in this.dbEntity.HOT_MEALS
    join ml in this.dbEntity.HOT_MEALS_PRICE   on m.MEALSID equals ml.MEALSID into mls
    from mls1 in mls.DefaultIfEmpty()
    where mls1.HOTID==hotelId
    select new DTOHotMealsPrice
    {
        MEALSID = m.MEALSID,
        MEALSNAME = m.MEALSNAME,
        CHPRICE = mls1.CHPRICE,
        PRICE = mls1.PRICE,
        HOTID = mls1.HOTID
    }).Distinct().ToList();

When a mealsid reference appears, I want to show all HOT MEALS and also link them with HOT MEALS PRICE.

When mls1.HOTID==hotelId this will provide results for the innerjoin. How might it provide an appropriate outcome?

1
0
5/26/2017 8:29:48 AM

Accepted Answer

ZZZ_tmp
0
5/26/2017 12:02:57 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow