예제 #1
0
 public static Classifier ToClassifier(this ClassifierDto dto)
 {
     return(new Classifier
     {
         Id = dto.Id,
         Name = dto.Name,
         Description = dto.Description,
         ParentId = dto.ParentId,
         Classifiers = dto.Classifiers.Select(cl => cl.ToClassifier()).ToList()
     });
 }
예제 #2
0
 public static Classifier ToEntity(this ClassifierDto dto)
 {
     return(new Classifier
     {
         Id = dto.Id,
         Name = dto.Name,
         Description = dto.Description,
         Classifiers = dto.Classifiers?.Select(e => e.ToEntity()).ToList(),
         Words = dto.Words?.Select(e => e.ToEntity()).ToList(),
         ParentId = dto.ParentId
     });
 }
예제 #3
0
        private void AddCurrentWordToClassifier(ClassifierDto classif, string classifierName)
        {
            try
            {
                var curClassifier = _allClassifierDtos.First(cl => cl.Name == classifierName);

                if (curClassifier != null)
                {
                    curClassifier.Words = curClassifier?.Words ?? new List <WordDto>();
                    curClassifier.Words.Add(new WordDto
                    {
                        Name = WordToStore
                    });
                    _classifierService.Update(curClassifier);
                }
            }
            catch (Exception e)
            {
            }
        }
예제 #4
0
 public bool DeleteWordFromClassifier(int wordId, ClassifierDto dto)
 {
     return(DeleteWordFromClassifier(wordId, dto.Id));
 }
예제 #5
0
 public ClassifierDto PutClassifier([FromBody] ClassifierDto classifierDto)
 {
     return(new ClassifierDto(dal.SaveClassifier(classifierDto)));
 }
예제 #6
0
 public ClassifierDto PostClassifier([FromBody] ClassifierDto classifierDto)
 {
     return(new ClassifierDto(dal[classifierDto.TypeCode].AddMember(classifierDto)));
 }