public ActionResult Edit(BranchdetailVM poViewModel) { ViewBag.AC_MENU_ID = valMENU.PENGATURAN_PUSAT_EDIT; oVAL = new Branch_Validation(poViewModel); oVAL.Validate_Edit(); //Add Error if exists for (int i = 0; i < oVAL.aValidationMSG.Count; i++) { ModelState.AddModelError(oVAL.aValidationMSG[i].VAL_ERRID, oVAL.aValidationMSG[i].VAL_ERRMSG); } //End for (int i = 0; i < oVAL.aValidationMSG.Count; i++) if (ModelState.IsValid) { poViewModel.BRANCH_TYPE = 1; // Pusat oCRUD.Update(poViewModel); if (oCRUD.isERR) { TempData["ERRMSG"] = oCRUD.ERRMSG; return(RedirectToAction("ErrorSYS", "Error")); } //End if (!oCRUD.isERR) { TempData["CRUDSavedOrDelete"] = valFLAG.FLAG_TRUE; return(RedirectToAction("Details")); } return(View(poViewModel)); }
public ActionResult Create(BranchdetailVM poViewModel) { ViewBag.AC_MENU_ID = valMENU.PENGATURAN_CABANG_CREATE; oVAL = new Branch_Validation(poViewModel); oVAL.Validate_Create(); //Add Error if exists for (int i = 0; i < oVAL.aValidationMSG.Count; i++) { ModelState.AddModelError(oVAL.aValidationMSG[i].VAL_ERRID, oVAL.aValidationMSG[i].VAL_ERRMSG); } //End for (int i = 0; i < oVAL.aValidationMSG.Count; i++) if (ModelState.IsValid) { poViewModel.BRANCH_TYPE = 2; // Cabang oCRUD.Create(poViewModel); if (oCRUD.isERR) { TempData["ERRMSG"] = oCRUD.ERRMSG; return(RedirectToAction("ErrorSYS", "Error")); } //End if (!oCRUD.isERR) { TempData["CRUDSavedOrDelete"] = valFLAG.FLAG_TRUE; return(RedirectToAction("Details", new { id = oCRUD.ID })); } //End if (ModelState.IsValid) return(View(poViewModel)); }