Exemple #1
0
 public bool ValidateFirebaseSetting(FirebaseSettingDto dto)
 {
     try
     {
         new ExamService(dto.ProjectId, dto.JsonCredentials);
         return(true);
     }
     catch (System.Exception)
     {
         return(false);
     }
 }
Exemple #2
0
        public async Task <FirebaseSettingDto> CreateOrFirebaseSetting(FirebaseSettingDto dto)
        {
            var container = _cosmosClient.GetContainer(DatabaseId, ContainerId);
            var entity    = dto.To <FirebaseSetting>();

            if (string.IsNullOrEmpty(dto.Id))
            {
                entity.Id = Guid.NewGuid().ToString();
                var response = await container.CreateItemAsync <FirebaseSetting>(entity, new PartitionKey(dto.UserId));

                entity = response.Resource;
            }
            else
            {
                var response = await container.ReplaceItemAsync <FirebaseSetting>(entity, entity.Id, new PartitionKey(entity.UserId));

                entity = response.Resource;
            }

            return(entity.To <FirebaseSettingDto>());
        }
Exemple #3
0
 public async Task <FirebaseSettingDto> CreateOrFirebaseSetting(FirebaseSettingDto dto)
 {
     return(await _service.CreateOrFirebaseSetting(dto));
 }