protected override async Task <IResponseContainer> GetResultAsync(UpdateConnectorRequest request) { IResponseContainer result = new ResponseContainer(); var connector = await connectorRepository.GetByChargeStationIdAndLineNoAsync(request.ChargeStationId, request.LineNo); if (connector is null) { result.AddErrorMessage($"Connector with ID={request.ChargeStationId} is not found."); return(result); } var updateResponseContainer = await connector.UpdateMaxCurrentInAmps(request.MaxCurrentInAmps, groupRepository); result.JoinWith(updateResponseContainer); if (result.IsSuccess) { var previousValue = connector.MaxCurrentInAmps; await connectorRepository.UpdateAsync(connector); Log.Info($"Connector with ID={connector.GetNumericId()} is updated with new value {request.MaxCurrentInAmps}, previous value was {previousValue}."); } else { Log.Error(result.Messages); } return(result); }
public Task <IResponseContainer> IsSatisfiedBy(Group entity) { var result = new ResponseContainer(); if (capacityInAmps <= 0) { result.AddErrorMessage($"Capacity has to be greater than 0."); } var nameSpecificationResponseContainer = new NameSpecification().IsSatisfiedBy(name).Result; result.JoinWith(nameSpecificationResponseContainer); return(Task.FromResult(result.AsInterface())); }