/// <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) { }
public TranslationRepository(TranslatorDbContext context) { _context = context; }
public TranslatorGroupService(TranslatorDbContext db, IMapper mapper) : base(db) { this.mapper = mapper; }