123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- using Aip.Service.Aip.Models;
- using Aip.Service.Aip.Serivces;
- using Aip.Service.Models.Response;
- using Aip.Service.Repositories;
- using Aip.Service.Services.Interfaces;
- namespace Aip.Service.Services;
- public class ApiAipService : BaseService, IApiAipService
- {
- private readonly ILogger<ApiAipService> _log;
- private readonly AipFileService _aipFileService;
- public ApiAipService(ILogger<ApiAipService> log, IApiConfigService aipConfigService, AipFileService aipFileService)
- : base(aipConfigService)
- {
- _log = log;
- _aipFileService = aipFileService;
- }
- public async Task<GeneralResponse> DownloadAipInfo()
- {
- try
- {
- var task = Task.Run(() =>
- {
- int result = _aipConfigService.DownloadAipFileInformations();
- return result;
- });
- int result = await task;
- return new GeneralResponse
- {
- errorCode = 0,
- errorMessage = GlobalConstants.API_RESULT_SUCCESS,
- effectCount = result,
- };
- }
- catch (Exception e)
- {
- _log.LogError($"{e}");
- throw;
- }
- }
- public async Task<List<AipLabel>> GetLabels()
- {
- try
- {
- var task = Task.Run(() =>
- {
- return _aipFileService.SensitivityLabels();
- });
- List<AipLabel> result = await task;
- return result;
- }
- catch (Exception)
- {
- throw;
- }
- }
- public async Task<List<AipLabel>> GetPolicies()
- {
- try
- {
- var task = Task.Run(() =>
- {
- return _aipFileService.ListSensitivityLabels();
- });
- List<AipLabel> result = await task;
- return result;
- }
- catch (Exception)
- {
- throw;
- }
- }
- public async Task<List<AipTemplate>> GetProtections()
- {
- try
- {
- var task = Task.Run(() =>
- {
- return _aipFileService.GetTemplates();
- });
- List<AipTemplate> result = await task;
- return result;
- }
- catch (Exception)
- {
- throw;
- }
- }
- }
|