public ActionResult Index(string srcText, string sourceLang, string destLang)
        {
            ViewBag.DestLanguages =
                from c in _translator.GetTranslateDirs(sourceLang)
                select new SelectListItem
                {
                    Value = c.Item1,
                    Text = c.Item2
                };

            if (!(string.IsNullOrEmpty(srcText) || string.IsNullOrEmpty(sourceLang) || string.IsNullOrEmpty(destLang)))
            {
                string result = _translator.Translate(sourceLang, destLang, srcText);
                ViewBag.Result = result;

                var user = GetCurrentUser();
                if (user != null)
                {
                    History history = new History()
                    {
                        UserId = user.Id,
                        Time = DateTime.Now,
                        DestinationLanguage = destLang,
                        DestinationText = result,
                        SourceLanguage = sourceLang,
                        SourceText = srcText
                    };

                    _translationHistoryRepository.Add(history);
                }
            }

            PrepareData();
            return View();
        }
 public int Add(History item)
 {
     using (var context = new TranslatorHistoryDatabaseEntities())
     {
         context.History.Add(item);
         context.SaveChanges();
         return item.Id;
     }
 }