public ObjectResult Post([FromBody] MeterReadings meterReadings) { //if (!IsMeterReadingsValid(meterReadings)) { // return new BadRequestObjectResult("Internal Server Error"); //} _meterReadingService.StoreReadings(meterReadings.SmartMeterId, meterReadings.ElectricityReadings); return(new OkObjectResult("{}")); }
private bool IsMeterReadingsValid(MeterReadings meterReadings) { String smartMeterId = meterReadings.SmartMeterId; List <ElectricityReading> electricityReadings = meterReadings.ElectricityReading; return(smartMeterId != null && smartMeterId.Any() && electricityReadings != null && electricityReadings.Any()); }