Here is my method. I want to return the value of the variables and assign it to the model.
How to return values from the variables item1 and item2?
public async Task <(int, int)> GetCount(int CustId, string userId)
{
_log.Info($"Enter- GetCount");
const string query = @" Select count(*) from Products
Select count(*) from Units";
using (IDbConnection myConnection =
_getConnection.GetConnection(GetConnectionStringFromDict(userId)))
{
_log.Info($"Exit- GetCount");
using (var multi = await myConnection.QueryMultipleAsync(query, new { CustId
}).ConfigureAwait(false))
{
var item1 = multi.ReadFirstOrDefaultAsync<int>();
var item2 = multi.ReadFirstOrDefaultAsync<int>();
}
}
using (IDbConnection myConnection =
_getConnection.GetConnection(GetConnectionStringFromDict(userId)))
{
_log.Info($"Exit- GetCount");
return (await myConnection.QueryAsync<(int, int)>(query, new { CustId
}).ConfigureAwait(false)).FirstOrDefault();
}
}