I have two tables, I want to return the value of the first table and the name of the table,Tables are related,I used the following code but it has an error?
public async Task<Tuple<Guid,string>> GetProductionsHorse()
{
return await _context.Horses.Include(h => h.Production)
.Where(h => !h.IsRemove && h.IsAccept == 1)
.Select(p => new Tuple<Guid,string>(p.ProductionId, p.Production.Title))
.ToListAsync();
}
Can I access both values if I return the value?
>Solution :
Your method is declared as returning a single Tuple<Guid,string>. You are trying to return a List<Tuple<Guid,string>>, which is not the same thing.
Update your method signature to match the return value:
public async Task<List<Tuple<Guid,string>>> GetProductionsHorse()
