public ResponseData <List <Subject> > GetSubjects() { ResponseData <List <Subject> > response = new ResponseData <List <Subject> >(); SubjectFacade facade = new SubjectFacade(); try { response.Data = facade.GetAll(); } catch (Exception ex) { ExceptionHandlerFactory.Factory.GetResponseExceptionHandler(response).Handle(ex); } return(response); }
private void AddSubjectQueries(SubjectFacade subjectFacade) { Field <ListGraphType <SubjectType> >( "allSubjects", resolve: context => subjectFacade.GetAll() ); Field <SubjectType>("subject", arguments: new QueryArguments(new QueryArgument <IntGraphType> { Name = "id" }), resolve: context => { var id = context.GetArgument <int?>("id"); return(id != null ? (subjectFacade.GetById((int)id)) : null); } ); }