public IActionResult Add([FromBody] FlashObservationModel observation) { try { this.Storage.Add(observation.ToFlashObservation()); } catch (ArgumentException e) { return(this.BadRequest(e.Message)); } return(this.Ok()); }
internal static FlashObservation ToFlashObservation(this FlashObservationModel flashObservationDto) { return(new FlashObservation(flashObservationDto.Id, flashObservationDto.ObservationPoint.ToCoordinates(), flashObservationDto.Intensity, flashObservationDto.DurationMs, flashObservationDto.ObservationTime)); }