Esempio n. 1
0
 public WordValueModel ToValueModel(Word domainModel)
 {
     return new WordValueModel()
     {
         Id = domainModel.Id,
         Value = domainModel.Value
     };
 }
Esempio n. 2
0
 public WordModel ToApiModel(Word domainModel)
 {
     return new WordModel()
     {
         Id = domainModel.Id,
         LanguageId = domainModel.LanguageId,
         Value = domainModel.Value,
         Transcription = domainModel.Transcription,
         Description = domainModel.Description
     };
 }
Esempio n. 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;
     }
 }
Esempio n. 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;
     //}
 }