public async Task SetBranchesAssignedManagers(SeniorManagerIndexVM indexVM) { foreach (Branch branch in indexVM.Branches) { branch.AssignedManager = await _repo.Manager.GetManagerByBranchId(branch.BranchId); } }
// GET: SeniorManagers public async Task <IActionResult> Index() { SeniorManagerIndexVM indexVM = new SeniorManagerIndexVM(); indexVM.SeniorManager = await GetCurrentSeniorManager(); if (indexVM.SeniorManager == null) { return(RedirectToAction("Create")); } indexVM.Branches = await _repo.Branch.GetAllBranches(indexVM.SeniorManager.SeniorManagerId); await SetBranchesAssignedManagers(indexVM); await SetBranchesQualityOfWorks(indexVM.Branches); return(View(indexVM)); }