RoleService.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using Microsoft.AspNetCore.Http;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using TEAMModelOS.Model.Core.Models;
  7. using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
  8. using TEAMModelOS.Service.Core.Interfaces;
  9. namespace TEAMModelOS.Service.Core.Implements
  10. {
  11. public class RoleService : IRoleService
  12. {
  13. private IAzureTableDBRepository _repository;
  14. private IHttpContextAccessor _httpContextAccessor;
  15. public RoleService(IAzureTableDBRepository repository,IHttpContextAccessor httpContextAccessor)
  16. {
  17. _httpContextAccessor = httpContextAccessor;
  18. _repository = repository;
  19. }
  20. public async Task<List<Role>> FindRolesByDict(Dictionary<string, object> dict)
  21. {
  22. if (dict.Count <= 0)
  23. {
  24. return await _repository.FindAll<Role>();
  25. }
  26. else
  27. {
  28. return await _repository.FindListByDict<Role>(dict);
  29. }
  30. }
  31. public async Task<List<RoleSchool>> FindRolesSchoolByDict(Dictionary<string, object> dict)
  32. {
  33. if (dict.Count <= 0)
  34. {
  35. return await _repository.FindAll<RoleSchool>();
  36. }
  37. else
  38. {
  39. return await _repository.FindListByDict<RoleSchool>(dict);
  40. }
  41. }
  42. }
  43. }