Ejemplo n.º 1
0
        public async Task <ActionResult> Details(string hashedAccountId, string hashedCommitmentId)
        {
            if (!await IsUserRoleAuthorized(hashedAccountId, Role.Owner, Role.Transactor))
            {
                return(View("AccessDenied"));
            }

            var model = await _employerCommitmentsOrchestrator.GetCommitmentDetails(hashedAccountId, hashedCommitmentId, OwinWrapper.GetClaimValue(@"sub"));

            var groupes = model.Data.ApprenticeshipGroups.Where(m => m.ShowOverlapError);

            foreach (var groupe in groupes)
            {
                var errorMessage = groupe.TrainingProgramme?.Title != null
                    ? $"{groupe.TrainingProgramme?.Title ?? ""} apprentices training dates"
                    : "Apprentices training dates";

                ModelState.AddModelError($"{groupe.GroupId}", errorMessage);
            }

            model.Data.BackLinkUrl = GetReturnToListUrl(hashedAccountId);
            SetFlashMessageOnModel(model);

            ViewBag.HashedAccountId = hashedAccountId;

            return(View(model));
        }