예제 #1
0
        public async Task <IActionResult> Create(LanguageParameter language)
        {
            if (ModelState.IsValid)
            {
                var isCreated = await _languageBusiness.AddLanguage(language);

                if (isCreated)
                {
                    return(RedirectToAction("Index"));
                }
            }
            return(View(language));
        }
        public async Task <IActionResult> AddLanguage(LanguageParameter languageParameter)
        {
            if (ModelState.IsValid)
            {
                var isAdded = await _languageBusiness.AddLanguage(languageParameter);

                if (isAdded)
                {
                    var result = await _languageBusiness.GetAllLanguages();

                    return(Ok(result));
                }

                return(NoContent());
            }
            return(BadRequest(ModelState));
        }