public ActionResult Edit(BusinessObjects.Models.Branch branch) { try { if (ModelState.IsValid) { ClaimsPrincipal principal = HttpContext.User as ClaimsPrincipal; branch.bankId = Convert.ToInt32(principal.FindFirst("BankId").Value); BusinessAccessLayer.BALCommon.BALCommon bALCommon = new BusinessAccessLayer.BALCommon.BALCommon(); BusinessAccessLayer.BALBranches.BALBranches bALBranches = new BusinessAccessLayer.BALBranches.BALBranches(); BusinessObjects.Models.ResultsEnum checkUpdated = bALBranches.updateBranch(branch); if (checkUpdated == BusinessObjects.Models.ResultsEnum.notUpdated) { TempData["errorMsg"] = LangText.checkConnection; return(RedirectToAction("Home", "Branches")); } else if (checkUpdated == BusinessObjects.Models.ResultsEnum.updated) { return(RedirectToAction("Home", "Branches")); } else { TempData["errorMsg"] = LangText.somethingWentWrongAlert; return(RedirectToAction("Home", "Branches")); } } else { return(View()); } } catch (Exception ex) { ExceptionsWriter.saveEventsAndExceptions(ex, "Exceptions not handled", EventLogEntryType.Error); return(View("Error")); } }
public ActionResult Edit(BusinessObjects.Models.Branch branch) { try { if (ModelState.IsValid) { branch.bankId = ((BusinessObjects.Models.User)Session["UserObj"]).bankId; BusinessAccessLayer.BALCommon.BALCommon bALCommon = new BusinessAccessLayer.BALCommon.BALCommon(); BusinessAccessLayer.BALBranches.BALBranches bALBranches = new BusinessAccessLayer.BALBranches.BALBranches(); BusinessObjects.Models.ResultsEnum checkUpdated = bALBranches.updateBranch(branch); if (checkUpdated == BusinessObjects.Models.ResultsEnum.notUpdated) { TempData["errorMsg"] = LangText.checkConnection; return(RedirectToAction("Home", "Branches")); } else if (checkUpdated == BusinessObjects.Models.ResultsEnum.updated) { return(RedirectToAction("Home", "Branches")); } else { TempData["errorMsg"] = LangText.somethingWentWrongAlert; return(RedirectToAction("Home", "Branches")); } } else { return(View()); } } catch (Exception ex) { ExceptionsWriter.saveExceptionToLogFile(ex); return(View("Error")); } }