Пример #1
0
        private void AddNotificationQueries(NotificationFacade notificationFacade)
        {
            Field <ListGraphType <NotificationType> >(
                "allNotifications",
                resolve: context => notificationFacade.GetAll()
                );

            Field <NotificationType>("notification",
                                     arguments: new QueryArguments(new QueryArgument <IntGraphType> {
                Name = "id"
            }),
                                     resolve: context => {
                var id = context.GetArgument <int?>("id");

                return(id != null ? (notificationFacade.GetById((int)id)) : null);
            }
                                     );


            Field <ListGraphType <NotificationType> >("notificationsByGroupId",
                                                      arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IntGraphType> > {
                Name = "groupId"
            }),
                                                      resolve: context => {
                var groupId = context.GetArgument <int>("groupId");

                return(notificationFacade.GetByGroupId(groupId));
            }
                                                      );
        }