コード例 #1
0
        public async Task<ActionResult> AddTranslation(ArchiveTranslation t)
        {
            if (ModelState.IsValid)
            {
                db.AddTranslation(t);
                await db.SaveChangesAsync();

                return RedirectToAction("Index");
            }

            return View(t);
        }
コード例 #2
0
        //public async Task<ActionResult> AddTranslation()
        public ActionResult AddTranslation()
        {
            var archive = db.Set<Archive>().FirstOrDefault();

            var t = new ArchiveTranslation
            {
                ArchiveId = archive.Id
            };

            ViewBag.Languages =
                LanguageDefinitions.GenerateAvailableLanguageDDL(archive.Translations.Select(tr => tr.LanguageCode));

            return View(t);
        }