public async Task <ActionResult> StatusUpdate( Guid reportId, ReportStatusUpdateDto status, [FromServices] ReportStatusUpdate updater) { await updater.StatusUpdate(status.UserId, reportId, status.ReportStatusId, status.Description); return(Ok()); }
public async Task <ActionResult> ReportStartProgress( ReportStartProgressDto progress, [FromServices] ReportStatusUpdate updater) { Guid statusInProgress = Guid.Parse("c37d9588-1875-44dd-8cf1-6781de7533c3"); await updater.StatusUpdate(progress.UserId, progress.ReportId, statusInProgress, progress.Description); return(Ok(progress)); }
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()); }
public async Task <ActionResult> ReportStartProgress( ReportEndProgressDto progress, [FromServices] ReportStatusUpdate updater) { Guid statusInProgress = Guid.Parse("ee6dda1a-51e2-4041-9d21-7f5c8f2e94b0"); await updater.StatusUpdate(progress.UserId, progress.ReportId, statusInProgress, progress.Description); var inProgress = await _reportInProgressService.GetByReportId(progress.ReportId); inProgress.DoneDate = progress.EndDate; inProgress.OwnerUserId = progress.UserId; await _reportInProgressService.Update(inProgress); return(Ok(progress)); }