Esempio n. 1
0
        /// <summary>
        /// Saves record to database using EntityFramework
        /// </summary>
        /// <param name="source">Source word</param>
        /// <param name="translationType">Translation type used for processing</param>
        /// <param name="result">Output of translation</param>
        private void SaveToDatabase(string source, string translationType, string result)
        {
            var dbContext   = new TranslatorDbContext();
            var translation = new Translation
            {
                Date            = DateTime.Now,
                Source          = source,
                TranslatedText  = result,
                TranslationType = translationType
            };

            dbContext.Translations.Add(translation);
            dbContext.SaveChanges();
            dbContext.Dispose();
        }
 public TranslatorService(TranslatorDbContext db) : base(db)
 {
 }
Esempio n. 3
0
 public TranslationRepository(TranslatorDbContext context)
 {
     _context = context;
 }
Esempio n. 4
0
 public TranslatorGroupService(TranslatorDbContext db, IMapper mapper) : base(db)
 {
     this.mapper = mapper;
 }