예제 #1
0
        public IActionResult Update(int id, string name)
        {
            ListAuthorResponse response = new ListAuthorResponse();

            response.Id   = id;
            response.Name = name;
            return(View(response));
        }
예제 #2
0
        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));
        }
예제 #3
0
        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));
        }