SchoolSystemService.cs 987 B

12345678910111213141516171819202122232425262728293031
  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<SchoolSystem> SaveToCosmosDB(SchoolSystem system)
  18. {
  19. await _cosmosrepository.Save(system);
  20. return system;
  21. }
  22. public async Task<SchoolSystem> UpdateSchool(SchoolSystem system)
  23. {
  24. await _cosmosrepository.ReplaceObject(system, system.Id,system.Code);
  25. return system;
  26. }
  27. }
  28. }