Exemplo n.º 1
0
        public IActionResult Add([FromBody] FlashObservationModel observation)
        {
            try
            {
                this.Storage.Add(observation.ToFlashObservation());
            }
            catch (ArgumentException e)
            {
                return(this.BadRequest(e.Message));
            }

            return(this.Ok());
        }
Exemplo n.º 2
0
 internal static FlashObservation ToFlashObservation(this FlashObservationModel flashObservationDto)
 {
     return(new FlashObservation(flashObservationDto.Id, flashObservationDto.ObservationPoint.ToCoordinates(),
                                 flashObservationDto.Intensity, flashObservationDto.DurationMs, flashObservationDto.ObservationTime));
 }