public BookStoreQuery(IAuthorManager authorManager, IBookManager bookManager)
        {
            Field <ListGraphType <AuthorType> >(
                "all_authors",
                resolve: context => authorManager.GetAll());

            Field <AuthorType>(
                "author_by_id",
                arguments: new QueryArguments(new QueryArgument <IntGraphType> {
                Name = "id"
            }),
                resolve: context => authorManager.GetById(context.GetArgument <int>("id")));

            Field <AuthorType>(
                "get_error",
                resolve: context => authorManager.GetError());

            Field <ListGraphType <BookType> >(
                "all_books",
                resolve: contex => bookManager.GetAll());

            Field <BookType>(
                "book_by_id",
                arguments: new QueryArguments(new QueryArgument <IntGraphType> {
                Name = "id"
            }),
                resolve: context => bookManager.GetById(context.GetArgument <int>("id")));
        }
예제 #2
0
        // GET: Authors/Details/5
        public IActionResult Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var author = _iAuthorManager.GetById(id);

            if (author == null)
            {
                return(NotFound());
            }

            return(View(author));
        }
예제 #3
0
 public Author Get(int id)
 {
     return(_authorManager.GetById(id));
 }