|
@@ -79,7 +79,15 @@ namespace EVCB_OCPP.WEBAPI.Controllers.Version1
|
|
|
[Route("information")]
|
|
|
[Produces(typeof(CPOOuterResponse))]
|
|
|
[HttpGet]
|
|
|
- public IActionResult BasicInformationofEVSEs(int? Limit = -1, int StationId = -1, string ChargeBoxId = "", DateTime? DateFrom = null, DateTime? DateTo = null, int? Offset = 0)
|
|
|
+ public async Task<IActionResult> BasicInformationofEVSEs(
|
|
|
+ [FromServices] ChargePointService _CPService,
|
|
|
+ [FromServices] ChargingStationService _stationService,
|
|
|
+ int? Limit = -1,
|
|
|
+ int StationId = -1,
|
|
|
+ string ChargeBoxId = "",
|
|
|
+ DateTime? DateFrom = null,
|
|
|
+ DateTime? DateTo = null,
|
|
|
+ int? Offset = 0)
|
|
|
{
|
|
|
|
|
|
var result = new CPOOuterResponse();
|
|
@@ -87,8 +95,8 @@ namespace EVCB_OCPP.WEBAPI.Controllers.Version1
|
|
|
int statusCode = StatusCodes.Status500InternalServerError;
|
|
|
try
|
|
|
{
|
|
|
- ChargePointService _CPService = serviceProvider.GetRequiredService<ChargePointService>();// new ChargePointService();
|
|
|
- var tt = _CPService.GetLastUpdatedTimebyMachineId("0da4f4a6-a952-46f0-b2f3-696385a9a56a");
|
|
|
+ //ChargePointService _CPService = serviceProvider.GetRequiredService<ChargePointService>();// new ChargePointService();
|
|
|
+ //var tt = _CPService.GetLastUpdatedTimebyMachineId("0da4f4a6-a952-46f0-b2f3-696385a9a56a");
|
|
|
if (!IsCustomerIdAvaliable())
|
|
|
{
|
|
|
//return Request.CreateResponse(statusCode, result);
|
|
@@ -98,11 +106,11 @@ namespace EVCB_OCPP.WEBAPI.Controllers.Version1
|
|
|
var _customerId = GetCustomerId();
|
|
|
|
|
|
var _innerResponse = new { EVSEs = new List<EVSE>() };
|
|
|
- ChargingStationService _stationService = serviceProvider.GetRequiredService<ChargingStationService>();// new ChargingStationService();
|
|
|
+ //ChargingStationService _stationService = serviceProvider.GetRequiredService<ChargingStationService>();// new ChargingStationService();
|
|
|
|
|
|
if (StationId > -1)
|
|
|
{
|
|
|
- if (_stationService.ContainsStation(_customerId, StationId))
|
|
|
+ if (await _stationService.ContainsStation(_customerId, StationId))
|
|
|
{
|
|
|
if (DateTo.HasValue)
|
|
|
{
|
|
@@ -117,15 +125,15 @@ namespace EVCB_OCPP.WEBAPI.Controllers.Version1
|
|
|
return StatusCode(statusCode, result);
|
|
|
}
|
|
|
}
|
|
|
- _innerResponse = new { EVSEs = _stationService.GetEVSEsbyStationId(StationId, DateFrom, DateTo, Offset.Value, Limit == -1 ? 1000 : Limit.Value) };
|
|
|
-
|
|
|
+ //_innerResponse = new { EVSEs = _stationService.GetEVSEsbyStationId(StationId, DateFrom, DateTo, Offset.Value, Limit == -1 ? 1000 : Limit.Value) };
|
|
|
+ _innerResponse.EVSEs.AddRange(await _stationService.GetEVSEsbyStationIdAsync(StationId, DateFrom, DateTo, Offset.Value, Limit == -1 ? 1000 : Limit.Value));
|
|
|
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
_innerResponse = new { EVSEs = new List<EVSE>() };
|
|
|
- _innerResponse.EVSEs.Add(_CPService.GetEVSEsbyChargeBoxId(ChargeBoxId, DateFrom, DateTo));
|
|
|
+ _innerResponse.EVSEs.Add(await _CPService.GetEVSEsbyChargeBoxId(_customerId, ChargeBoxId, DateFrom, DateTo));
|
|
|
|
|
|
|
|
|
}
|
|
@@ -738,7 +746,7 @@ namespace EVCB_OCPP.WEBAPI.Controllers.Version1
|
|
|
|
|
|
var _innerResult = await _client.Delete(
|
|
|
string.Format(urlformat, Request.Scheme, Request.Host.ToUriComponent()),
|
|
|
- string.Format("/api/v1/ocpp16/chargingprofile?ChargeBoxId={2}{3}", ChargeBoxId, ChargeProfileId == -1 ? "" : "&Id=" + ChargeProfileId),
|
|
|
+ string.Format("/api/v1/ocpp16/chargingprofile?ChargeBoxId={0}{1}", ChargeBoxId, ChargeProfileId == -1 ? "" : "&Id=" + ChargeProfileId),
|
|
|
new Dictionary<string, string>()
|
|
|
{
|
|
|
{ "PartnerId",_CustomerId}
|