Advertisement
Guest User

Untitled

a guest
Jul 18th, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. namespace InteractiveMap.Repositories
  2. {
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Threading.Tasks;
  7. using InteractiveMap.Data;
  8. using InteractiveMap.Data.Entities;
  9. using InteractiveMap.Repositories.Contracts;
  10. using Microsoft.EntityFrameworkCore;
  11.  
  12. /// <summary>
  13. /// Repository responsible for dealing with Employee entities.
  14. /// </summary>
  15. public class EmployeeRepository : GenericRepository<Employee>, IEmployeeRepository, IRepository<Employee>
  16. {
  17. /// <summary>
  18. /// Field containing project's database context
  19. /// </summary>
  20. private readonly InteractiveMapDbContext context;
  21.  
  22. /// <summary>
  23. /// Initializes a new instance of the <see cref="EmployeeRepository"/> class.
  24. /// </summary>
  25. /// <param name="context">Project database context</param>
  26. public EmployeeRepository(InteractiveMapDbContext context)
  27. : base(context)
  28. {
  29. this.context = context;
  30. }
  31.  
  32. /// <inheritdoc/>
  33. public Task<Employee> GetEmployeeByWorkPlaceNumberAsync(int workplaceNumber)
  34. {
  35. throw new NotImplementedException();
  36. }
  37.  
  38. /// <inheritdoc/>
  39. public async Task<ICollection<Employee>> GetEmployeesByInterestAsync(int interestId)
  40. {
  41. var result = await this.context.InterestsEmployees
  42. .Where(i => i.InterestId == interestId)
  43. .Select(e => e.Employee).ToListAsync();
  44.  
  45. return result;
  46. }
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement