BaseService.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using HiTeachCC.Service.Core.Interface;
  2. using Microsoft.WindowsAzure.Storage.Table;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
  8. using TEAMModelOS.SDK.Module.AzureTable.Implements;
  9. namespace HiTeachCC.Service.Core.Implement
  10. {
  11. public class BaseService : AzureTableDBRepository, IBaseService
  12. {
  13. public async Task<List<T>> FindListByDictHasAll<T>(Dictionary<string, object> dict) where T : TableEntity, new()
  14. {
  15. if (dict.Count <= 0)
  16. {
  17. return await FindAll<T>();
  18. }
  19. else
  20. {
  21. return await FindListByDict<T>(dict);
  22. }
  23. }
  24. public async Task<int> DeleteAll<T>(Dictionary<string, object> dict) where T : TableEntity, new()
  25. {
  26. List<T> list = await FindListByDict<T>(dict);
  27. if (list.IsNotEmpty())
  28. {
  29. list = await DeleteAll<T>(list);
  30. return list.Count;
  31. }
  32. else
  33. {
  34. return 0;
  35. }
  36. }
  37. }
  38. }