public void CreateResume(UserDto user, ResumeDto resume) { var dbUser = new User(); var users = _uow.Users.GetAll(); foreach (var u in users) { if (u.Email != user.Email) { continue; } dbUser = u; break; } var mapcfg = new MapperConfiguration(cfg => cfg.CreateMap <ResumeDto, Resume>()); var mapper = mapcfg.CreateMapper(); var res = mapper.Map <ResumeDto, Resume>(resume); res.User = dbUser; try { dbUser.Resume = res; _uow.Users.Update(dbUser); _uow.Resumes.Create(res); _uow.Save(); } catch (Exception) { throw new InvalidResumeException(); } }
public static AnnouncementGetListResponseModel ToAnnouncementGetListMappingModel(this List <Apply> model) { if (model != null && model.Count > 0) { AnnouncementGetListResponseModel responseModel = new AnnouncementGetListResponseModel(); var announcement = model.FirstOrDefault().Announcement; responseModel.Description = announcement.Description; responseModel.Location = announcement.Location; responseModel.CreatedDate = announcement.CreatedDate; responseModel.EndDate = announcement.EndDate; responseModel.Resumes = new List <ResumeDto>(); foreach (var item in model) { if (item.Resume != null) { var educations = new List <EducationDto>(); var experiences = new List <ExperienceDto>(); foreach (var education in item.Resume.Educations) { educations.Add(new EducationDto { Name = education.Name, Department = education.Department, EndDate = education.EndDate }); } foreach (var experience in item.Resume.Experiences) { experiences.Add(new ExperienceDto { Title = experience.Title, CompanyName = experience.CompanyName, StartDate = experience.StartDate, EndDate = experience.EndDate }); } var resume = new ResumeDto() { CreatedDate = item.Resume.CreatedDate, Educations = educations, Experiences = experiences }; responseModel.Resumes.Add(resume); } } return(responseModel); } return(null); }
public async Task <IActionResult> Post([FromBody] ResumeDto resumeDto) { var entity = _mapper.Map <Resume>(resumeDto); var result = await _resumeService.CreateAsync(entity); return(this.Ok(entity.Id)); }
public async Task <IActionResult> UpdateResumeFromLoggedApplicant([FromBody] ResumeDto resumeDto) { var result = await _mediator.Send(new UpdateResumeForLoggedApplicantCommand(resumeDto)); return(CreateResponseOnPut(result)); }