コード例 #1
0
        public async Task <IActionResult> AddLanguage([FromBody] Language language)
        {
            var createLanguage = await _language.AddAsync(language);

            if (createLanguage)
            {
                return(Ok("Language Created"));
            }
            else
            {
                return(BadRequest(new { message = "Unable to create language details" }));
            }
        }
コード例 #2
0
        public async Task <IActionResult> Create(Language language)
        {
            var createLanguage = await _language.AddAsync(language);

            if (createLanguage)
            {
                Alert("Language created successfully", NotificationType.success);
                return(RedirectToAction("Index"));
            }
            else
            {
                Alert("Language not created", NotificationType.error);
            }
            return(View());
        }