public async Task <IActionResult> GetPlacementOrEmployerAsync(int opportunityId, int opportunityItemId) { var opportunityItemCount = await _opportunityService.GetSavedOpportunityItemCountAsync(opportunityId); var viewModel = await _opportunityService.GetCheckAnswersAsync(opportunityItemId); var opportunities = await _opportunityService.GetOpportunityBasketAsync(viewModel.OpportunityId); return(opportunities.ReferralCount switch { 0 when opportunityItemCount >= 1 => RedirectToRoute("GetPlacementInformation", new { opportunityItemId }), 0 when opportunities.ProvisionGapCount == 1 => RedirectToRoute("GetEmployerDetails", new { opportunityId = viewModel.OpportunityId, opportunityItemId }), 0 when opportunities.ProvisionGapCount == 0 => RedirectToRoute("GetEmployerDetails", new { opportunityId = viewModel.OpportunityId, opportunityItemId }), _ => RedirectToRoute("GetPlacementInformation", new { opportunityItemId }) });
public When_Recording_Referrals_And_Check_Answers_Is_Loaded() { var config = new MapperConfiguration(c => c.AddMaps(typeof(CheckAnswersDtoMapper).Assembly)); var mapper = new Mapper(config); var dto = new ValidCheckAnswersDtoBuilder().Build(); _opportunityService = Substitute.For <IOpportunityService>(); _opportunityService.GetCheckAnswersAsync(OpportunityItemId).Returns(dto); var opportunityController = new OpportunityController(_opportunityService, mapper); var controllerWithClaims = new ClaimsBuilder <OpportunityController>(opportunityController) .AddUserName(CreatedBy) .Build(); _result = controllerWithClaims.GetCheckAnswersAsync(OpportunityItemId).GetAwaiter().GetResult(); }
public async Task <IActionResult> GetCheckAnswersAsync(int opportunityItemId) { var viewModel = await _opportunityService.GetCheckAnswersAsync(opportunityItemId); return(View("CheckAnswers", viewModel)); }