public async Task <IActionResult> DeleteConfirmed(string submitbutton, string language_state, [Bind("Id", "LangNo, LangNa, LangEn")] Language language) { if (!LoginUtil.CheckIfLoggedIn(HttpContext)) { return(View(nameof(Index))); } StateOfRequest mState; if (string.IsNullOrEmpty(language_state)) { mState = new StateOfRequest("LangNo"); } else { mState = JsonUtil.GetObjectFromJsonString <StateOfRequest>(language_state); } mState.StartTime = DateTime.Now; string temp_state = JsonUtil.SetJsonStringFromObject(mState); int orgId = mState.OrgId; string sButton = submitbutton.ToUpper(); if (sButton == "CANCEL") { temp_state = JsonUtil.SetJsonStringFromObject(mState); return(RedirectToAction(nameof(LanguagesList), new { language_state = temp_state })); } if (ModelState.IsValid) { // start deleting the language from table int result = await _languagesManager.DeleteOneLanguageById(orgId); if (result == ErrorCodeModel.Succeeded) { // succeeded to delete a language List <Language> languagesTemp = _languagesManager.GetOnePageOfLanguages(mState); temp_state = JsonUtil.SetJsonStringFromObject(mState); ViewBag.LanguageState = temp_state; return(View(nameof(LanguagesList), languagesTemp)); } else { ViewData["ErrorMessage"] = ErrorCodeModel.GetErrorMessage(result); } } else { // Model.IsValid = false ViewData["ErrorMessage"] = ErrorCodeModel.GetErrorMessage(ErrorCodeModel.ModelBindingFailed); } // failed ViewBag.LanguageState = temp_state; return(View(language)); }