public async Task <IActionResult> Edit(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; // = language.Id 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 updating table int result = await _languagesManager.UpdateOneLanguageById(orgId, language); if (result == ErrorCodeModel.Succeeded) { // succeeded to update Language newLanguage = new Language(); List <Language> languagesTemp = _languagesManager.FindOnePageOfLanguagesForOneLanguage(mState, newLanguage, orgId); 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); } ViewBag.LanguageState = temp_state; return(View(language)); }