private bool BeNonExistingAreaRequest(NewAreaRequest request)
        {
            var allAreas = _areaService.GetAllAreas();

            return(!allAreas.Any(area =>
                                 Math.Round(area.Latitude, 6) == Math.Round(request.Latitude, 6) &&
                                 Math.Round(area.Longitude, 6) == Math.Round(request.Longitude, 6) &&
                                 area.Radius == request.Radius));
        }
Example #2
0
        public async Task <ActionResult> GetAllAreas(bool includeAreaOwners)
        {
            try
            {
                using (_areaLogger.BeginScope($"API-GetAllAreas-Inititating {DateTime.UtcNow}"))
                {
                    var result = await _areaService.GetAllAreas(includeAreaOwners).ConfigureAwait(false);

                    _areaLogger.LogInformation($"API-GetAllAreas-Completed {DateTime.UtcNow}");

                    return(StatusCode((int)result.statusCode, result.areaDtos));
                }
            }
            catch (Exception ex)
            {
                _areaLogger.LogError
                    (ex,
                    $"API-GetAllAreas-Exception {DateTime.UtcNow}"
                    );

                return(StatusCode((int)HttpStatusCode.BadRequest,
                                  _apiSettings.IsSecuredEnvironment ? "An error occured while processing GetAllAreas" : ex.ToString()));
            }
        }