SchoolSystemService.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Threading.Tasks;
  5. using TEAMModelOS.Model.BaseInfo.Models;
  6. using TEAMModelOS.SDK.Module.AzureCosmosDB.Interfaces;
  7. using TEAMModelOS.Service.Core.Interfaces;
  8. namespace TEAMModelOS.Service.Core.Implements
  9. {
  10. public class SchoolSystemService : BaseService, ISchoolSystemService
  11. {
  12. public IAzureCosmosDBRepository _cosmosrepository;
  13. public SchoolSystemService(IAzureCosmosDBRepository cosmosDBRepository)
  14. {
  15. _cosmosrepository = cosmosDBRepository;
  16. }
  17. public async Task<List<School>> FindSchoolInfo(Dictionary<string, object> code)
  18. {
  19. return await _cosmosrepository.FindByParams<School>(code);
  20. }
  21. public async Task<School> SaveToCosmosDB(School system)
  22. {
  23. await _cosmosrepository.Save(system);
  24. return system;
  25. }
  26. public async Task<School> UpdateSchool(School system)
  27. {
  28. await _cosmosrepository.ReplaceObject(system, system.Id,system.Code);
  29. return system;
  30. }
  31. }
  32. }