Created
January 2, 2021 07:42
-
-
Save JIOO-phoeNIX/7c5d218da5c4a2ffc4a591b883d62111 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using GraphQLSampleApp.DataAccess.DAO; | |
using GraphQLSampleApp.DataAccess.Entity; | |
using HotChocolate; | |
using HotChocolate.Subscriptions; | |
using System.Collections.Generic; | |
using System.Threading.Tasks; | |
namespace GraphQLSampleApp.DataAccess | |
{ | |
public class Query | |
{ | |
public List<Employee> AllEmployeeOnly([Service] EmployeeRepository employeeRepository) => | |
employeeRepository.GetEmployees(); | |
public List<Employee> AllEmployeeWithDepartment([Service] EmployeeRepository employeeRepository) => | |
employeeRepository.GetEmployeesWithDepartment(); | |
public async Task<Employee> GetEmployeeById([Service] EmployeeRepository employeeRepository, | |
[Service]ITopicEventSender eventSender, int id) | |
{ | |
Employee gottenEmployee = employeeRepository.GetEmployeeById(id); | |
await eventSender.SendAsync("ReturnedEmployee", gottenEmployee); | |
return gottenEmployee; | |
} | |
public List<Department> AllDepartmentsOnly([Service] DepartmentRepository departmentRepository) => | |
departmentRepository.GetAllDepartmentOnly(); | |
public List<Department> AllDepartmentsWithEmployee([Service] DepartmentRepository departmentRepository) => | |
departmentRepository.GetAllDepartmentsWithEmployee(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment