Quantcast
Channel: Web API
Viewing all articles
Browse latest Browse all 4850

geting 2 none relation table in one results asp.net api

$
0
0

Hello,

 in my Db I have 2 none relation table that I would like to get results from both of them in my web Api controller .

in my repository  I'm just asking for IEnumerable list . how can I get it ? 

My repo look like this 

  public IEnumerable<Cafe> getAllCafes()
        {
            return _cotx.Cafe.OrderBy(c => c.SynCity).ToList();
        }
        public IEnumerable<Restaurants> getAllResturant()
        {
            return _cotx.Restaurantses.OrderBy(c => c.City).ToList();
        }

& I would like to get more or less something like this : (any direction in how to  will help )Thanks

  [HttpGet]
        public IActionResult Get()
        {
          //return Ok( from c in  _repository.GetAllSynagugesByCity.Select c,
            return Ok(_repository.getAllCafes().GroupJoin(_repository.getAllResturant) );
        }


Viewing all articles
Browse latest Browse all 4850

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>