예제 #1
0
        public async void AddJournalEntry(int interventionId, int journalId, [FromBody] NewJournalEntryDto newJournalEntry)
        {
            var entry = _mapper.Map <JournalEntry>(newJournalEntry);

            entry.JournalId = journalId;
            _journalService.AddEntry(entry);
            await _interventionHub.Clients.All.SendAsync("journalUpdated", interventionId, journalId);
        }
예제 #2
0
        public async Task <IActionResult> AddEntry(long journalId, [FromBody] NewEntry newEntry)
        {
            Entry entry;

            try
            {
                entry = await _journalService.AddEntry(journalId, newEntry);
            }
            catch (JournalNotFoundException ex)
            {
                return(NotFound(ex.Message));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }

            return(CreatedAtAction(nameof(AddEntry), entry));
        }
        public async Task <IActionResult> CreateJournalEntry([FromBody] JournalEntry entry)
        {
            await _service.AddEntry(entry);

            return(Ok());
        }