public bool AddDictionary(DictionaryExtnDTO dictionaryDTO, int userId)
        {
            var dictionary = MappingDictionaryExtn.MappingDTOtoDM(dictionaryDTO);

            dictionary.Credential = _dal.GetCredentialById(userId);
            return(_dal.AddDictionary(dictionary));
        }
 private void AddDictionary_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (_dal.IsDictionaryNameExists(nameField.Text, userId))
         {
             MaterialMessageBox.ShowError("Dictionary with this name already exists. Please re-enter name of the dictionary");
             nameField.Text = String.Empty;
         }
         else if (String.IsNullOrWhiteSpace(nameField.Text))
         {
             MaterialMessageBox.ShowError("Please fill in name of the dictionary");
         }
         else
         {
             var newDictionaey = new DictionaryExtnDTO
             {
                 Name = nameField.Text
             };
             _dal.AddDictionary(newDictionaey, userId);
             Helper.log.Info($"User with id: {userId} has added dictionary: {newDictionaey.Name}");
             this.Close();
         }
     }
     catch (Exception ex)
     {
         Helper.log.Error(ex.ToString());
         MaterialMessageBox.ShowError(ex.ToString());
     }
 }
Exemple #3
0
        public static DictionaryExtnDC MappingDTOtoDC(DictionaryExtnDTO dictionaryDTO)
        {
            MapperConfiguration configDTOtoDC = new MapperConfiguration(cfg => {
                cfg.CreateMap <DictionaryExtnDTO, DictionaryExtnDC>();
            });
            IMapper iMapper = configDTOtoDC.CreateMapper();

            return(iMapper.Map <DictionaryExtnDTO, DictionaryExtnDC>(dictionaryDTO));
        }
Exemple #4
0
        public bool AddDictionary(DictionaryExtnDTO dictionaryDTO, int userId)
        {
            var dictionaryDC = MappingDictionaryExtn.CredentialDTOtoDC(dictionaryDTO);

            return(vocabularyClient.AddDictionary(dictionaryDC, userId));
        }