Skip to content

Instantly share code, notes, and snippets.

@JIOO-phoeNIX
Created January 2, 2021 07:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JIOO-phoeNIX/7c5d218da5c4a2ffc4a591b883d62111 to your computer and use it in GitHub Desktop.
Save JIOO-phoeNIX/7c5d218da5c4a2ffc4a591b883d62111 to your computer and use it in GitHub Desktop.
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