/// <summary> /// Returns a recommendation model from the given domain recommendation response. /// </summary> /// <param name="obj">The object.</param> /// <param name="linkGenerator">The link generator.</param> /// <param name="httpContextAccessor">The HTTP context accessor.</param> /// <returns></returns> public static ProjectRecommendationsModel FromRecommendationResponse(RecommendationResponse obj, LinkGenerator linkGenerator, IHttpContextAccessor httpContextAccessor) { var userModels = new List <CandidateModel>(); foreach (var candidate in obj.Matches) { var userModel = CandidateModel.FromCandidate(candidate); userModel.PhotoUrl = linkGenerator.GetUriByAction(httpContextAccessor.HttpContext, "Get", "Photo", new { id = candidate.UserId }); userModels.Add(userModel); } var result = new ProjectRecommendationsModel { Matches = userModels }; return(result); }
/// <summary> /// Returns a recommendation model from the given domain recommendation response. /// </summary> /// <param name="obj">The object.</param> /// <param name="linkGenerator">The link generator.</param> /// <param name="httpContextAccessor">The HTTP context accessor.</param> /// <returns></returns> public static ProjectRecommendationsModel FromRecommendationResponse(RecommendationResponse obj, LinkGenerator linkGenerator, IHttpContextAccessor httpContextAccessor) { var userModels = new List <CandidateModel>(); //foreach (var candidate in obj.Matches) //{ // CandidateModel userModel = A.New<CandidateModel>().FromCandidate(candidate); // userModel.PhotoUrl = linkGenerator.GetUriByAction(httpContextAccessor.HttpContext, "Get", "Photo", new { id = candidate. }); // userModels.Add(userModel); //} var result = new ProjectRecommendationsModel { Matches = userModels, TotalItems = userModels.Count }; return(result); }