39 lines
1.7 KiB
C#
39 lines
1.7 KiB
C#
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels;
|
|
using LCU.Library.Internal.CoreApiWrapperLib.Utilities;
|
|
using LCU.Library.Internal.CoreApiWrapperLib.Configuration;
|
|
using LCU.Library.Internal.CoreApiWrapperLib.CoreApiUtilities;
|
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Branches;
|
|
|
|
namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess
|
|
{
|
|
public class BranchDao : BaseCoreDao, IBranchDao
|
|
{
|
|
private readonly CoreConfiguration _coreConfiguration;
|
|
private readonly CoreApiConfiguration _coreApiConfiguration;
|
|
|
|
public BranchDao(ICoreRequest coreRequest,
|
|
CoreConfiguration coreConfiguration)
|
|
: base(coreRequest)
|
|
{
|
|
_coreConfiguration = coreConfiguration;
|
|
_coreApiConfiguration = _coreConfiguration.CoreApiConfiguration;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Calls Core API to get all branches.
|
|
/// Default Included: Graph
|
|
/// </summary>
|
|
/// <returns>IEnumerable<Branch></returns>
|
|
public async Task<IEnumerable<Branch>> FindBranches(CoreRequestParameters coreRequestParameters)
|
|
{
|
|
var endpointParameters = HttpUtilities.BuildDictionaryOfNonNullValues(coreRequestParameters);
|
|
var result = await _coreRequest.GetRequestObject<CoreApiMessage<IEnumerable<Branch>>>(
|
|
_coreApiConfiguration.CoreEndPointConfiguration.Branches,
|
|
endpointParameters);
|
|
return result?.MessageBody;
|
|
}
|
|
}
|
|
}
|