Exemple #1
0
        private Task <Guid> RunAsync(MeasurementDto measurementDto)
        {
            _measurementRepository.AddMeasurement(
                testSeriesId: _context.TestSeriesId,
                MAC: measurementDto.MAC,
                RSSI: measurementDto.RSSI,
                channel: measurementDto.Channel);

            return(Task.FromResult(Guid.NewGuid()));
        }
Exemple #2
0
        public ActionResult <Entities.Measurement> AddMeasurement(Models.MeasurementDto measurement)
        {
            var measurementEntity = _mapper.Map <Entities.Measurement>(measurement);

            _measurementsRepository.AddMeasurement(measurementEntity);
            _measurementsRepository.Save();

            return(CreatedAtRoute("AddMeasurement",
                                  new { measurementId = measurementEntity.MeasurementId },
                                  measurementEntity));
        }
 public HttpResponseMessage AddMeasurement([FromBody] MeasurementViewModel model)
 {
     try
     {
         var data = repo.AddMeasurement(model);
         if (data != null)
         {
             return(Request.CreateResponse(HttpStatusCode.OK, new { success = true, result = model, message = "the record has successfully been created" }));
         }
         return(Request.CreateResponse(HttpStatusCode.OK, new { success = false, message = "there was an error creating this record" }));
     }
     catch (Exception e)
     {
         return(Request.CreateResponse(HttpStatusCode.OK, new { success = false, message = $"there was an error creating this record {e.Message}" }));
     }
 }