public ActionResult Edit(int branchId)
 {
     try
     {
         BusinessAccessLayer.BALBranches.BALBranches bALBranches = new BusinessAccessLayer.BALBranches.BALBranches();
         BusinessObjects.Models.Branch branch = bALBranches.selectBranchById(branchId, ((BusinessObjects.Models.User)Session["UserObj"]).bankId);
         if (branch == null)
         {
             TempData["errorMsg"] = LangText.checkConnection;
             return(RedirectToAction("Home", "Branches"));
         }
         else if (branch.id == 0)
         {
             TempData["errorMsg"] = LangText.somethingWentWrongAlert;
             return(RedirectToAction("Home", "Branches"));
         }
         else
         {
             return(View(branch));
         }
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveExceptionToLogFile(ex);
         return(View("Error"));
     }
 }
 public ActionResult Edit(int branchId)
 {
     try
     {
         BusinessAccessLayer.BALBranches.BALBranches bALBranches = new BusinessAccessLayer.BALBranches.BALBranches();
         ClaimsPrincipal principal            = HttpContext.User as ClaimsPrincipal;
         var             bankId               = Convert.ToInt32(principal.FindFirst("BankId").Value);
         BusinessObjects.Models.Branch branch = bALBranches.selectBranchById(branchId, bankId);
         if (branch == null)
         {
             TempData["errorMsg"] = LangText.checkConnection;
             return(RedirectToAction("Home", "Branches"));
         }
         else if (branch.id == 0)
         {
             TempData["errorMsg"] = LangText.somethingWentWrongAlert;
             return(RedirectToAction("Home", "Branches"));
         }
         else
         {
             return(View(branch));
         }
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveEventsAndExceptions(ex, "Exceptions not handled", EventLogEntryType.Error);
         return(View("Error"));
     }
 }