Example #1
0
        public IActionResult Create([FromBody] AuthorDTO item)
        {
            if (item == null)
            {
                return(BadRequest());
            }

            _authorsService.AddAuthor(item);

            return(Ok(item));
        }
        public async Task <IActionResult> AddAuthor(AuthorInputModel input)
        {
            if (!ModelState.IsValid)
            {
                return(this.View(input));
            }
            var result = await authorsService.AddAuthor(input.Name, input.Bio);

            var message = result.Message;
            var id      = result.ResultId;

            return(RedirectToAction("Index", "DatabaseSeeding", new { message = message, id = id }));
        }