public WordValueModel ToValueModel(Word domainModel)
 {
     return new WordValueModel()
     {
         Id = domainModel.Id,
         Value = domainModel.Value
     };
 }
 public WordModel ToApiModel(Word domainModel)
 {
     return new WordModel()
     {
         Id = domainModel.Id,
         LanguageId = domainModel.LanguageId,
         Value = domainModel.Value,
         Transcription = domainModel.Transcription,
         Description = domainModel.Description
     };
 }
Beispiel #3
0
 public int Add(Word word)
 {
     using (var context = new WorldOfWordsDatabaseContext())
     {
         if (Exists(word.Value, word.LanguageId) > 0)
         {
             return -1;
         }
         context.Words.Add(word);
         context.SaveChanges();
         return word.Id;
     }
 }
Beispiel #4
0
 public int Add(Word word)
 {
     using (var uow = _unitOfWorkFactory.GetUnitOfWork())
     {
         if (Exists(word.Value, word.LanguageId) > 0)
         {
             return -1;
         }
         uow.WordRepository.Add(word);
         uow.Save();
         return word.Id;
     }
     //using (var context = new WorldOfWordsDatabaseContext())
     //{
     //    if (Exists(word.Value, word.LanguageId) > 0)
     //    {
     //        return -1;
     //    }
     //    context.Words.Add(word);
     //    context.SaveChanges();
     //    return word.Id;
     //}
 }