Ejemplo n.º 1
0
        public async Task SavePredictionSet(string name, PredictionSet set)
        {
            List <RuleModel>     rules             = set.RuleSet;
            List <PredictionSet> tmpPredictionSets = _predictionSetData.GetPredictionDataSets();

            if (tmpPredictionSets.FirstOrDefault(c => c.Name == set.Name) != null)
            {
                Exception error = new Exception($"RuleManagement: prediction set already exist");
                throw error;
            }

            string fileName = name + ".json";
            string json     = JsonConvert.SerializeObject(rules, Formatting.Indented);
            string url      = await _fileStorage.SaveFileUri(ruleShare, fileName, json);

            set.RuleUrl = url;
            _predictionSetData.SavePredictionDataSet(set);
        }