Knocks/BackEnd/Knoks.Api/Data/Dao/ApiConsumerDao.cs

29 lines
855 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Knoks.Api.Data.Interfaces;
using Knoks.Api.Entities;
using Knoks.Framework.DataAccess;
using Microsoft.Extensions.Logging;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Knoks.Api.Data.Dao
{
public class ApiConsumerDao : IApiConsumerDao
{
private readonly IProcExecutor _executor;
private readonly ILogger<ApiConsumerDao> _logger;
public ApiConsumerDao(IProcExecutor executor, ILogger<ApiConsumerDao> logger)
{
_logger = logger;
_executor = executor;
}
public async Task<IEnumerable<ApiConsumer>> GetApiConsumers()
{
_logger.LogDebug("GetApiConsumers invoked");
return (await _executor.Go("API_GetApiConsumers")).Тables[0].Rows.Select(row => row.To<ApiConsumer>());
}
}
}