コード例 #1
0
        public ActionResult Create([Bind("ixLanguage,sLanguage,sLanguageCode")] LanguagesPost languages)
        {
            if (ModelState.IsValid)
            {
                languages.UserName = User.Identity.Name;
                _languagesService.Create(languages);
                return(RedirectToAction("Index"));
            }

            return(View(languages));
        }
コード例 #2
0
        public async Task <IActionResult> Create(Language language)
        {
            try
            {
                // if (ModelState.IsValid)
                language = await languagesService.Create(language);

                return(Ok(language));
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }