public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            int      randomSpeed = random.Next(-20, 375);
            Location location    = LocationRepo.GetLocation(LocationId);

            try
            {
                _speedMeasurementRepo.AddSpeedMeasurement(randomSpeed, location, MockData.RandomImage);
            }
            catch (CalibrationException cex)
            {
                CreateOtionsList();
                InfoText = $"Error. The camera must be calibrated contact the support department or try again! {cex.Message}";
                return(Page());
            }
            catch (ArgumentException aex)
            {
                CreateOtionsList();
                InfoText = $"Error. The camera must be calibrated contact the support department or try again! {aex.Message}";
                return(Page());
            }
            catch (Exception ex)
            {
                InfoText = $"Error. Something went wrong!Contact the support department {ex.Message}";
                CreateOtionsList();
                return(Page());
            }
            return(RedirectToPage("Index"));
        }
        public IActionResult OnPost()
        {
            Location l = _locations.GetLocation(LocationId);

            try
            {
                _measurements.AddSpeedMeasurement(MockData.RandomSpeed, _locations.GetLocation(LocationId), MockData.RandomImage);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                InvalidPost = e.Message;
                OnGetMeasurement();
                return(Page());
            }

            return(RedirectToPage("Index"));
        }