Ejemplo n.º 1
0
        public async Task <IActionResult> PatchAsync([FromRoute] string WikiUrl, [FromBody] Wiki wiki)
        {
            try
            {
                if (wiki.PageName == null && wiki.Description == null)
                {
                    return(BadRequest("wiki values cannot all be null"));
                }

                if (wiki.PageName != null)
                {
                    await _wikiRepository.SetNameAsync(WikiUrl, wiki.PageName);
                }

                if (wiki.Description != null)
                {
                    await _wikiRepository.SetMDAsync(WikiUrl, wiki.Description);
                }
            }
            catch (WikiNotFoundException e)
            {
                _logger.LogError(e.Message);
                return(NotFound());
            }

            return(NoContent());
        }