Пример #1
0
        public async Task <IActionResult> PostAsync([FromRoute] string WikiUrl, [FromBody] Wiki wiki)
        {
            try
            {
                if (wiki.PageName != null)
                {
                    await _wikiRepository.NewWikiAsync(WikiUrl, wiki.PageName, wiki.Description);
                }
                else
                {
                    await _wikiRepository.NewWikiAsync(WikiUrl, wiki.Description);
                }

                return(CreatedAtAction(actionName: nameof(GetAsync), routeValues: new { WikiUrl }, value: null));
            }
            catch (Exception e)
            {
                _logger.LogError(e.Message);
                //if request is duplicated
                return(Conflict("Post request must be unique"));
            }
        }