示例#1
0
        public ActionResult <JournalDetailDto> GetJournalDetail(int interventionId, int journalId)
        {
            var             id   = 0;
            var             name = string.Empty;
            InterventionDto intervention;

            if (journalId > 0)
            {
                var journal = _journalService.Get(journalId);
                id           = journal.Id;
                name         = journal.Name;
                intervention = _mapper.Map <InterventionDto>(journal.Intervention);
            }
            else
            {
                intervention = _mapper.Map <InterventionDto>(_interventionService.Get(interventionId));
            }

            return(new JournalDetailDto
            {
                Id = id,
                Name = name,
                Intervention = intervention,
                Entries = _journalService.GetJournalEntries(interventionId, journalId).Select(x => new JournalEntryDto
                {
                    Id = x.Id,
                    JournalName = x.Journal.Name,
                    Message = x.Message,
                    DateTime = x.DateTime,
                    ChannelId = x.JournalEntryChannel.Id,
                    Name = x.Name,
                    Direction = x.Direction
                }).OrderByDescending(x => x.DateTime).ToArray()
            });
        }
示例#2
0
 public ActionResult <InterventionDto> GetIntervention(int id)
 {
     return(_mapper.Map <InterventionDto>(_interventionService.Get(id)));
 }