public ActionResult Create(EntityDepartmentModel model) { if (null == Session[this.SESSION_NAME_USERID]) { return(RedirectToAction("Login", "Home")); } if (Session["IsAdmin"] == null) { return(RedirectToAction("Logout", "Home")); } this.SetConnectionDB(); this.GetLanguage(); int output = 0; if (model.Code == null) { Session["msg_code"] = -1; Session["msg_text"] = BlockLanguageModel.GetElementLang(this.LANGUAGE_OBJECT, "messages.block_department_create.error_code"); TempData["data"] = model; return(RedirectToAction("Create")); } model.Code = model.Filter01.Substring(0, 2); DepartmentServices departServices = new DepartmentServices(this.DBConnection); output = departServices.CreateDepart(model); /****************************************RESPONSE FAILE OR SUCCESS******************************************/ //this.GetLanguage(); BlockDepartmentCreateLangModel blockLang = new BlockDepartmentCreateLangModel(); blockLang.BlockName = "block_department_create"; blockLang.SetLanguage(this.LANGUAGE_OBJECT); Session["msg_text"] = blockLang.GetMessage(output); Session["msg_code"] = output; if (departServices.ERROR != null) { BI_Project.Helpers.FileHelper.SaveFile(departServices.ERROR, this.LOG_FOLDER + "/ERROR_" + this.GetType().ToString() + BI_Project.Helpers.Utility.APIStringHelper.GenerateFileId() + ".txt"); } if (model.DepartId > 0 && output > 0) { Session["msg_text"] = blockLang.GetLangByPath("messages.block_department_create.success_edit", this.LANGUAGE_OBJECT); } if (output == 0) { Session["msg_text"] = blockLang.GetLangByPath("messages.block_department_create.error_business_1", this.LANGUAGE_OBJECT); //return RedirectToAction("Create?roleid=" + model.RoleId); } if (output > 0) { return(RedirectToAction("List")); } TempData["data"] = model; return(RedirectToAction("Create")); }