public ActionResult Apply(ResumeInfo model, FormCollection fc) { /* * 设置_CommmonLayout.cshtml中的变量 */ ViewBag.RootCategoryInfo = ViewBag.CurrentCategoryInfo = CategoryService.Get(GeneralConfig.JobRootId); int jobId = CECRequest.GetQueryInt("jobId", 0); var jobInfo = JobService.Get(jobId); if (jobInfo.Id <= 0) { return(Redirect("/job")); } if (Request.HttpMethod.ToUpper() == "POST") { //生日 model.Birthday = string.Format("{0}-{1}", fc["Year"], fc["Month"]); //籍贯 string birthplace = string.Empty; string province = fc["Province"], city = fc["City"], town = fc["Town"]; if (!string.IsNullOrEmpty(province)) { birthplace = province; if (!string.IsNullOrEmpty(city)) { birthplace += "-" + city; if (!string.IsNullOrEmpty(town)) { birthplace += "-" + town; } } } model.BirthPlace = birthplace; int id = ResumeService.Create(model).Id; bool status = false; if (id > 0) { status = true; } //POST ViewBag.Status = status; } ViewBag.JobInfo = jobInfo; return(View(model)); }
public IActionResult Post([FromBody] Resume resume) { if (!ModelState.IsValid) { return(BadRequest()); } var createdResume = _resumeService.Create(resume); if (createdResume == null) { return(BadRequest()); } var createdResumeDTO = new ResumeDTO(createdResume); return(Ok(createdResumeDTO)); }