public ActionResult <string> Resume([FromBody] Post input) { if (!ModelState.IsValid) { return(BadRequest()); } // var post = _iPostService.GetById(input.PostId); DataSet allResumes = productRepository.GetResumes(); list = DataSetToList <Resume>(allResumes, 0); finalResult = calculate.GetMatchingResultsByPost(list, input); foreach (var recommend in finalResult) { Recommend recommends = new Recommend { ResumeId = recommend.ResumeId, PostId = recommend.PostId, CompanyId = recommend.CompanyId, RecommendNumber = recommend.RecommendNumber }; _iRecommendService.Create(recommends, recommends.PostId, recommends.ResumeId); } return(Output("ok", 1)); }
public IActionResult Register([FromBody] RecommendModel recommendModel) { // map dto to entity var recommend = _iMapper.Map <Recommend>(recommendModel); try { // save var result = _iRecommendService.Create( recommend, recommendModel.PostId, recommendModel.ResumeId); var count = 1; if (result != null) { return(Output(new DeleteOrUpdateResponse { id = result.RecommendId, }, count)); } throw new Exception("创建失败!"); } catch (AppException ex) { // return error message if there was an exception return(BadRequest(new { message = ex.Message })); } }
public ActionResult <string> Post([FromBody] Resume input) { if (!ModelState.IsValid) { return(BadRequest()); } DataSet allPosts = productRepository.GetPosts(); list = DataSetToList <Post>(allPosts, 0); //DataSet allResumes = productRepository.GetResumes(); //lists = DataSetToList<Resume>(allResumes, 0); // foreach (var resume in lists) // { // finalResult = calculate.GetMatchingResultsByResume(resume, list); // Console.WriteLine("简历信息:期望职位名:{0},期望薪资:{1},工作经验年限:{2},技能:{3}", resume.resumePostName, //resume.resumeSalary, //resume.workYear, resume.skill); // foreach (var recommend in finalResult) // { // var post = _iPostService.GetById(recommend.PostId); // Console.WriteLine("职位信息:职位名:{0},薪资:{1},工作经验年限要求:{2},职位描述:{3}", post.PostName, post.PostSalary, // post.PostExperience, post.PostDescription); // Console.WriteLine("----------------"); // } // } //foreach (var post in list) //{ // finalResult = calculate.GetMatchingResultsByPost(lists, post); // Console.WriteLine("职位信息:职位名:{0},薪资:{1},工作经验年限要求:{2},职位描述:{3}", post.PostName, post.PostSalary, // post.PostExperience, post.PostDescription); // foreach (var recommend in finalResult) // { // Console.WriteLine("----------------"); // var resume = _resumeService.GetById(recommend.ResumeId); // Console.WriteLine("简历信息:期望职位名:{0},期望薪资:{1},工作经验年限:{2},技能:{3}", resume.ResumePostName, // resume.ResumeSalary, // resume.WorkYear, resume.Skill); // } //} finalResult = calculate.GetMatchingResultsByResume(input, list); foreach (var recommend in finalResult) { Recommend recommends = new Recommend { ResumeId = recommend.ResumeId, PostId = recommend.PostId, CompanyId = recommend.CompanyId, RecommendNumber = recommend.RecommendNumber }; _iRecommendService.Create(recommends, recommends.PostId, recommends.ResumeId); } return(Output("ok", 5)); }