コード例 #1
0
        public async Task <bool> StatusUpdate(Guid userId, Guid reportId, Guid newStatusId, string updateDescription)
        {
            var reportToUpdate = await _reportRepository.GetById(reportId);

            Guid oldStatus = reportToUpdate.ReportStatusId;

            reportToUpdate.ReportStatusId = newStatusId;

            await _reportRepository.Update(reportToUpdate);

            InteractionHistory interaction = new InteractionHistory()
            {
                UserId            = userId,
                ReportId          = reportId,
                oldReportStatusId = oldStatus,
                NewReportStatusId = newStatusId,
                Description       = updateDescription,
                CreationDate      = DateTime.Now
            };

            await _interactionRepository.Add(interaction);

            var currentStatus = await _statusRepository.GetById(newStatusId);

            if (currentStatus.InProgress)
            {
                var records = await _progressRepo.Find(x => x.ReportId == reportToUpdate.Id);

                if (!records.Any())
                {
                    ReportInProgress inProgress = new ReportInProgress()
                    {
                        InteractionHistoryId = interaction.Id,
                        ReportId             = reportToUpdate.Id,
                        UserId       = interaction.UserId,
                        CreationDate = DateTime.Now
                    };

                    //TO-DO: Disparar notificacao para os usuários
                    await _progressRepo.Add(inProgress);
                }
            }

            await SendNotifications(reportToUpdate, interaction.Id);

            return(true);
        }
コード例 #2
0
 public async Task Update(ReportInProgress report)
 {
     await _repository.Update(report);
 }
コード例 #3
0
 public Task Remove(ReportInProgress report)
 {
     throw new NotImplementedException();
 }
コード例 #4
0
 public async Task Add(ReportInProgress report)
 {
     await _repository.Add(report);
 }