private void AddNotificationStudentQueries(NotificationStudentFacade notificationStudentFacade) { Field <ListGraphType <NotificationStudentType> >( "allNotificationStudents", resolve: context => notificationStudentFacade.GetAll() ); Field <NotificationStudentType>("notificationStudent", arguments: new QueryArguments(new QueryArgument <IntGraphType> { Name = "id" }), resolve: context => { var id = context.GetArgument <int?>("id"); return(id != null ? (notificationStudentFacade.GetById((int)id)) : null); } ); }
public NotificationType(NotificationStudentFacade notificationStudentFacade, GroupFacade groupFacade) { Field(x => x.Id); Field <StringGraphType>("message", resolve: context => context.Source.Message); Field <GroupType>("group", resolve: context => groupFacade.GetById(context.Source.GroupId) ); Field <ListGraphType <NotificationStudentType> >( "notificationStudents", resolve: context => notificationStudentFacade.GetByNotificationId(context.Source.Id)); Field <NotificationStudentType>("notificationStudent", arguments: new QueryArguments(new QueryArgument <IntGraphType> { Name = "id" }), resolve: context => notificationStudentFacade.GetById(context.GetArgument <int>("id"))); }