Пример #1
0
        public async Task Add()
        {
            await ArrangeTest();

            var journal = new NewJournalDto {
                Title = "Shiny New Title"
            };

            var response = await _client.PostAsync(URL(_user.Id), journal.AsStringContent());

            response.EnsureSuccessStatusCode();
        }
Пример #2
0
        public async Task <ActionResult> Add(string userId, NewJournalDto newJournal)
        {
            var journal = await _service.Add(userId, newJournal.Title);

            if (journal == null)
            {
                _logger.LogInformation($"Unable to add journal with title: {newJournal.Title}");
                return(BadRequest());
            }

            _logger.LogInformation($"Journal added: {newJournal.Title}");
            return(Ok(journal));
        }