public IActionResult Update(int id, string name) { ListAuthorResponse response = new ListAuthorResponse(); response.Id = id; response.Name = name; return(View(response)); }
public async Task <IActionResult> GetAuthor([FromBody] GetAuthorRequest request) { if (request == null) { return(NotFound()); } Author author = await _authorService.GetById(request.Id); ListAuthorResponse response = new ListAuthorResponse(); response.Id = author.Id; response.Name = author.Name; return(Ok(response)); }
public IActionResult ListAuthor() { List <Author> authors = _authorService.ListActiveOnes(); List <ListAuthorResponse> allResponses = new List <ListAuthorResponse>(); foreach (Author author in authors) { ListAuthorResponse response = new ListAuthorResponse(); response.Id = author.Id; response.Name = author.Name; allResponses.Add(response); } return(Ok(allResponses)); }