RoleService.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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<Role> FindRoleByDict(Dictionary<string, object> dict) {
  32. return await _repository.FindOneByDict<Role>(dict);
  33. }
  34. public async Task<List<SchoolRole>> FindSchoolRolesByDict(Dictionary<string, object> dict)
  35. {
  36. if (dict != null && dict.Count > 0)
  37. {
  38. return await _repository.FindListByDict<SchoolRole>(dict);
  39. }
  40. else
  41. {
  42. return null;
  43. //return await _repository.FindAll<SchoolRole>();
  44. }
  45. }
  46. public async Task<Role> FindRoleByRowKey(string rowKey) {
  47. return await _repository.FindByRowKey<Role>(rowKey);
  48. }
  49. }
  50. }