public async Task <IActionResult> Update([FromBody] BlogPost blogPost) { if (blogPost.IsValid(out IEnumerable <string> errors)) { var result = await _blogPostService.Update(blogPost); return(Ok(result)); } else { return(BadRequest(errors)); } }
public async Task <IActionResult> Create([FromBody] BlogPost blogPost) { if (blogPost.IsValid(out IEnumerable <string> errors)) { var result = await _blogPostService.Create(blogPost); return(CreatedAtAction( nameof(GetAllByUserAccountId), new { id = result.UserAccountId }, result)); } else { return(BadRequest(errors)); } }