public async Task <ActionResult> Post( ReportInsertDto report, [FromServices] ReportStatusUpdate statusUpdater ) { Report newReport = _mapper.Map <Report>(report); newReport.CreationDate = DateTime.Now; var city = await _geolocation.GetCityInfoFromLocation( report.Latitude, report.Longitude ); IEnumerable <City> cities = new List <City>(); if (city != null) { cities = await _cityRepository.Find( c => c.Name.ToLower().Contains(city.Name.ToLower()) ); } var cityFromRepo = cities.FirstOrDefault(); if (cityFromRepo == null) { NotifyError("As coordenadas informadas não estão cadastradas."); return(CustomResponse()); } newReport.CityId = cityFromRepo.Id; newReport.Street = city.Street; newReport.Neighborhood = city.Neighborhood; await _service.Add(newReport); if (ValidOperation()) { var created = await _repository.GetById(newReport.Id); await statusUpdater.StatusUpdate( newReport.UserId, newReport.Id, newReport.ReportStatusId, "Denúncia criada" ); return(CreatedAtAction(nameof(GetById), new { Id = newReport.Id, Version = "1.0" }, created)); } return(CustomResponse()); }