Files
2026-03-31 14:32:23 -05:00

39 lines
1.7 KiB
C#

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.Constants;
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Properties;
namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess
{
public class PropertyDao : BaseCoreDao, IPropertyDao
{
private readonly CoreConfiguration _coreConfiguration;
private readonly CoreApiConfiguration _coreApiConfiguration;
public PropertyDao(ICoreRequest coreRequest,
CoreConfiguration coreConfiguration)
: base(coreRequest)
{
_coreConfiguration = coreConfiguration;
_coreApiConfiguration = _coreConfiguration.CoreApiConfiguration;
}
/// <summary>
/// Calls Core API to get all property by propertynumber.
/// Default Included: Graph, Standard
/// </summary>
/// <returns>Property</returns>
public async Task<Property> FindProperty(long propertynumber)
{
var endpoint = HttpUtilities.ReplaceRootParameter(_coreApiConfiguration.CoreEndPointConfiguration.PropertyById,
RequestRootParameters.PropertyNumber,
propertynumber.ToString());
var result = await _coreRequest.GetRequestObject<CoreApiMessage<Property>>(endpoint, null);
return result?.MessageBody;
}
}
}