public ActionResult Education(EducationVM education) { if (education == null) { education = new EducationVM(); } else { int id = (int)Session["IdSelected"]; List <Education> educations = _resumeRepository.GetEducationByID(id).ToList(); int number = educations.Count; EducationVM[] OldArray = new EducationVM[number]; for (int i = 0; i < number; i++) { Mapper.Initialize(cfg => cfg.CreateMap <Education, EducationVM>()); OldArray[i] = Mapper.Map <EducationVM>(educations[i]); OldArray[i].TitleOfDiploma = educations[i].Title; OldArray[i].InstituteUniversity = educations[i].InstituteName; } //Fetch All previous EDUCATION DETAILS From Database and STORE IT IN "OLDArray" //IF DB returns == 0 then OldArray = null ViewData["History"] = OldArray; } education.ListOfCountry = GetCountries(); return(View(education)); }
public async Task<IActionResult> UpdateEducation(EducationVM vm) { var user = await _userManager.GetCurrentUser(HttpContext); if (vm.UserEducationID > 0) { UserEducation edu = _context.UserEducation.SingleOrDefault(x => x.UserEducationId == vm.UserEducationID); edu.Title = vm.Title; edu.SchoolName = vm.SchoolName; edu.CityId = vm.CityId; edu.CurrentStatusCheck = vm.CurrentStatusCheck; edu.Details = vm.Details; edu.StartDate = vm.StartDate; edu.EndDate = vm.EndDate; } else { UserEducation edu = new UserEducation(); edu.Title = vm.Title; edu.SchoolName = vm.SchoolName; edu.CityId = vm.CityId; edu.CurrentStatusCheck = vm.CurrentStatusCheck; edu.Details = vm.Details; edu.StartDate = vm.StartDate; edu.EndDate = vm.EndDate; edu.UserId = user.Id; _context.UserEducation.Add(edu); } _context.SaveChanges(); return RedirectToAction("Index"); //return View("Index"); }
public List <EducationVM> EducationVMList() { DataBankEntities vmdb = new DataBankEntities(); List <EducationVM> educationVMList = new List <EducationVM>(); var educationlist = (from edu in vmdb.Education join cv in vmdb.CV on edu.CV_ID equals cv.CV_ID select new { edu.SchoolName, edu.Subject, edu.Degree, edu.StartDate, edu.EndDate, cv.CV_ID }).ToList(); foreach (var item in educationlist) { EducationVM objcvm = new EducationVM(); objcvm.SchoolName = item.SchoolName; objcvm.Subject = item.Subject; objcvm.Degree = item.Degree; objcvm.StartDate = item.StartDate; objcvm.EndDate = item.EndDate; objcvm.Freelancer_ID = item.CV_ID; educationVMList.Add(objcvm); } return(educationVMList); }
public IHttpActionResult GetEducation(int Id) { var education = db.Educations.Where(x => x.Id == Id).FirstOrDefault(); var result = new ApiResult <EducationVM>(); if (education != null) { var educationModel = new EducationVM { Institution = education.Institution, Qualification = education.Qualification, CourseStudies = education.CourseStudied, Id = education.Id }; result.HasError = false; result.Message = "Successfully entered Education"; result.Data = educationModel; } else { // NotFound() return(BadRequest("Eductation records not found")); } return(Json(result)); }
public IHttpActionResult AddEducation(EducationVM model) { var response = new ApiResult <EducationVM>(); var currentApplicantId = (Membership.GetUser(User.Identity.Name) as CustomMembershipUser).ApplicantId; if (currentApplicantId == null) { return(Unauthorized()); } if (!ModelState.IsValid) { return(BadRequest("Incorrect data posted, please check form and try again")); } if (model.Id > 0) { var education = db.Educations.Where(x => x.Id == model.Id).FirstOrDefault(); if (education == null) { return(NotFound()); } else { education.Institution = model.Institution; education.CourseStudied = model.CourseStudies; education.FromDate = model.FromDate; education.ToDate = model.ToDate; education.Qualification = model.Qualification; db.SaveChanges(); } response.Message = "Updated successfully"; } else { var education = new Education { ApplicantId = (int)currentApplicantId, Institution = model.Institution, CourseStudied = model.CourseStudies, FromDate = model.FromDate, ToDate = model.ToDate, Qualification = model.Qualification }; db.Educations.Add(education); db.SaveChanges(); model.Id = education.Id; response.Message = "Added successfully"; } response.Data = model; response.HasError = false; return(Ok(response)); }
public PartialViewResult GetEducationCVPartial() { // int idPer = 0;// (int)Session["IdSelected"]; //Creating Mapping // Mapper.Initialize(cfg => cfg.CreateMap<Education, EducationVM>()); // IQueryable<EducationVM> educationList = _resumeRepository.GetEducationByID(idPer).ProjectTo<EducationVM>().AsQueryable(); EducationVM education = new EducationVM(); education.ListOfCountry = GetCountries(); return(PartialView("~/Views/Shared/CV/_MyEducationCV.cshtml", education)); }
public ActionResult AddOrUpdateEducation(EducationVM education) { int id = int.Parse(Session["IdSelected"].ToString()); //HERE we will save the Object to DATABASE //Based upon some conditions Mapper.Initialize(cfg => cfg.CreateMap <EducationVM, Education>()); Education EdutionEntity = Mapper.Map <Education>(education); EdutionEntity.Title = education.TitleOfDiploma; EdutionEntity.InstituteName = education.InstituteUniversity; EdutionEntity.FromYear = education.FromYear.Value.ToShortDateString(); EdutionEntity.ToYear = education.ToYear.Value.ToShortDateString(); _resumeRepository.AddOrUpdateEducation(EdutionEntity, id); return(RedirectToAction("Education")); }
//User Education public IActionResult AddEditUserEducation(int Id) { ViewBag.CountryList = new SelectList(GetCountryList(), "CountryId", "CountryName"); EducationVM vm = new EducationVM(); if (Id > 0) { UserEducation edu = _context.UserEducation.SingleOrDefault(x => x.UserEducationId == Id); vm.Title = edu.Title; vm.SchoolName = edu.SchoolName; vm.Details = edu.Details; vm.StartDate = edu.StartDate; vm.EndDate = edu.EndDate; vm.CurrentStatusCheck = edu.CurrentStatusCheck; vm.CityId = edu.CityId; vm.UserEducationID = edu.UserEducationId; } return PartialView(vm); }
public ActionResult AddOrUpdateEducation(EducationVM education) { string msg = string.Empty; if (education != null) { //Creating Mapping Mapper.Initialize(cfg => cfg.CreateMap <EducationVM, Education>()); Education educationEntity = Mapper.Map <Education>(education); int idPer = (int)Session["IdSelected"]; msg = _resumeRepository.AddOrUpdateEducation(educationEntity, idPer); } else { msg = "Please re try the operation"; } return(Json(new { data = msg }, JsonRequestBehavior.AllowGet)); }
public PartialViewResult EducationPartial(EducationVM education) { List <SelectListItem> ListofDegree = new List <SelectListItem>() { new SelectListItem { Text = "High School Diploma", Value = "High School Diploma" }, new SelectListItem { Text = "Diploma", Value = "Diploma" }, new SelectListItem { Text = "Bachelor's degree", Value = "Bachelor's degree" }, new SelectListItem { Text = "Master's degree", Value = "Master's degree" }, new SelectListItem { Text = "Doctorate", Value = "Doctorate" }, }; education.ListofDegree = ListofDegree; return(PartialView("~/Views/Resume/ResumeViews/MyEducation.cshtml", education)); }
// GET: PDF public ActionResult standardPDF() { int id = (int)Session["IdSelected"]; //////////////////////////////////////// Mapper.Initialize(cfg => cfg.CreateMap <Person, PersonVM>()); Person p = _resumeRepository.GetPersonalInformation(id); PersonVM pvm = Mapper.Map <PersonVM>(p); pvm.Tel = p.TelephoneNumber; pvm.FaceBookProfil = p.FacebookProfile; pvm.LinkedInProdil = p.LinkedinProfile; pvm.ImagePath = p.ProfilePicture; ViewBag.Person = pvm; //////////////////////////////////////// List <Education> educations = _resumeRepository.GetEducationByID(id).ToList(); int number = educations.Count; EducationVM[] OldArrayEdu = new EducationVM[number]; for (int i = 0; i < number; i++) { Mapper.Initialize(cfg => cfg.CreateMap <Education, EducationVM>()); OldArrayEdu[i] = Mapper.Map <EducationVM>(educations[i]); OldArrayEdu[i].TitleOfDiploma = educations[i].Title; OldArrayEdu[i].InstituteUniversity = educations[i].InstituteName; } ViewBag.educationArray = OldArrayEdu; //////////////////////////////////////// List <WorkExperience> works = _resumeRepository.GetWorkExperiencesById(id).ToList(); number = works.Count; WorkExperienceVM[] OldArraywork = new WorkExperienceVM[number]; for (int i = 0; i < number; i++) { Mapper.Initialize(cfg => cfg.CreateMap <WorkExperience, WorkExperienceVM>()); OldArraywork[i] = Mapper.Map <WorkExperienceVM>(works[i]); } ViewBag.workArray = OldArraywork; /////////////////////////////////////// List <Skill> skills = _resumeRepository.GetSkillsById(id).ToList(); number = skills.Count; SkillsVM[] OldSkillsArray = new SkillsVM[number]; for (int i = 0; i < number; i++) { Mapper.Initialize(cfg => cfg.CreateMap <Skill, SkillsVM>()); OldSkillsArray[i] = Mapper.Map <SkillsVM>(skills[i]); } ViewBag.skillsArray = OldSkillsArray; /////////////////////////////////////// List <Certification> allcertifications = _resumeRepository.GetCertificationsById(id).ToList(); number = allcertifications.Count; CertificationsVM[] OldcertificationArray = new CertificationsVM[number]; for (int i = 0; i < number; i++) { OldcertificationArray[i] = new CertificationsVM(); OldcertificationArray[i].CertificationName = allcertifications[i].CertificateName; OldcertificationArray[i].CertificateAuthority = allcertifications[i].CertificationAuthority; OldcertificationArray[i].LevelCertification = allcertifications[i].CertificationLevel; } ViewBag.certificatesArray = OldcertificationArray; /////////////////////////////////////// List <Language> alllanguages = _resumeRepository.GetLanguagesById(id).ToList(); number = alllanguages.Count; LanguageVM[] OldLanguagesArray = new LanguageVM[number]; for (int i = 0; i < number; i++) { Mapper.Initialize(cfg => cfg.CreateMap <Language, LanguageVM>()); OldLanguagesArray[i] = Mapper.Map <LanguageVM>(alllanguages[i]); } ViewBag.languagesArray = OldLanguagesArray; //string s =Path.GetFileName(Request.Url.AbsolutePath); //NReco.PdfGenerator.HtmlToPdfConverter htmlTo = new NReco.PdfGenerator.HtmlToPdfConverter(); //string html = gethtml("localhost:57666/PDF/standardPDF"); //var pdfBytes = (new NReco.PdfGenerator.HtmlToPdfConverter()).GeneratePdf(html); //System.IO.File.WriteAllBytes("hello.pdf", pdfBytes); return(View()); }
public ActionResult compactPDF() { int id = (int)Session["IdSelected"]; //////////////////////////////////////// Mapper.Initialize(cfg => cfg.CreateMap <Person, PersonVM>()); Person p = _resumeRepository.GetPersonalInformation(id); PersonVM pvm = Mapper.Map <PersonVM>(p); pvm.Tel = p.TelephoneNumber; pvm.FaceBookProfil = p.FacebookProfile; pvm.LinkedInProdil = p.LinkedinProfile; pvm.ImagePath = p.ProfilePicture; ViewBag.Person = pvm; //////////////////////////////////////// List <Education> educations = _resumeRepository.GetEducationByID(id).ToList(); int number = educations.Count; EducationVM[] OldArrayEdu = new EducationVM[number]; for (int i = 0; i < number; i++) { Mapper.Initialize(cfg => cfg.CreateMap <Education, EducationVM>()); OldArrayEdu[i] = Mapper.Map <EducationVM>(educations[i]); OldArrayEdu[i].TitleOfDiploma = educations[i].Title; OldArrayEdu[i].InstituteUniversity = educations[i].InstituteName; } ViewBag.educationArray = OldArrayEdu; //////////////////////////////////////// List <WorkExperience> works = _resumeRepository.GetWorkExperiencesById(id).ToList(); number = works.Count; WorkExperienceVM[] OldArraywork = new WorkExperienceVM[number]; for (int i = 0; i < number; i++) { Mapper.Initialize(cfg => cfg.CreateMap <WorkExperience, WorkExperienceVM>()); OldArraywork[i] = Mapper.Map <WorkExperienceVM>(works[i]); } ViewBag.workArray = OldArraywork; /////////////////////////////////////// List <Skill> skills = _resumeRepository.GetSkillsById(id).ToList(); number = skills.Count; SkillsVM[] OldSkillsArray = new SkillsVM[number]; for (int i = 0; i < number; i++) { Mapper.Initialize(cfg => cfg.CreateMap <Skill, SkillsVM>()); OldSkillsArray[i] = Mapper.Map <SkillsVM>(skills[i]); } ViewBag.skillsArray = OldSkillsArray; /////////////////////////////////////// List <Certification> allcertifications = _resumeRepository.GetCertificationsById(id).ToList(); number = allcertifications.Count; CertificationsVM[] OldcertificationArray = new CertificationsVM[number]; for (int i = 0; i < number; i++) { OldcertificationArray[i] = new CertificationsVM(); OldcertificationArray[i].CertificationName = allcertifications[i].CertificateName; OldcertificationArray[i].CertificateAuthority = allcertifications[i].CertificationAuthority; OldcertificationArray[i].LevelCertification = allcertifications[i].CertificationLevel; } ViewBag.certificatesArray = OldcertificationArray; /////////////////////////////////////// List <Language> alllanguages = _resumeRepository.GetLanguagesById(id).ToList(); number = alllanguages.Count; LanguageVM[] OldLanguagesArray = new LanguageVM[number]; for (int i = 0; i < number; i++) { Mapper.Initialize(cfg => cfg.CreateMap <Language, LanguageVM>()); OldLanguagesArray[i] = Mapper.Map <LanguageVM>(alllanguages[i]); } ViewBag.languagesArray = OldLanguagesArray; return(View()); }
private void Education(EducationVM vm) { _fontStyle = FontFactory.GetFont("Calibri", 11f, 1); _fontStyle.SetColor(33, 97, 140); _pdfPCell = new PdfPCell(new Phrase("Education", _fontStyle)); _pdfPCell.Colspan = _totalColumn; _pdfPCell.HorizontalAlignment = Element.ALIGN_LEFT; _pdfPCell.Border = 0; _pdfPCell.BackgroundColor = BaseColor.WHITE; _pdfPCell.ExtraParagraphSpace = 0; _pdfPTable.AddCell(_pdfPCell); _pdfPTable.CompleteRow(); _fontStyle = FontFactory.GetFont("Calibri", 10f, 1); _fontStyle.SetColor(25, 111, 61); _pdfPCell = new PdfPCell(new Phrase(vm.SchoolName, _fontStyle)); _pdfPCell.Colspan = 4; _pdfPCell.HorizontalAlignment = Element.ALIGN_LEFT; _pdfPCell.Border = 0; _pdfPCell.BackgroundColor = BaseColor.WHITE; _pdfPCell.ExtraParagraphSpace = 0; _pdfPTable.AddCell(_pdfPCell); _fontStyle = FontFactory.GetFont("Calibri", 10f, 0); if (vm.CurrentStatusCheck) { _pdfPCell = new PdfPCell(new Phrase(vm.StartDate.ToString("dd MMM yyyy") + " - Current", _fontStyle)); } else { _pdfPCell = new PdfPCell(new Phrase(vm.StartDate.ToString("dd MMM yyyy") + " - " + vm.EndDate.ToString("dd MMM yyyy"), _fontStyle)); } _pdfPCell.Colspan = 2; _pdfPCell.HorizontalAlignment = Element.ALIGN_RIGHT; _pdfPCell.Border = 0; _pdfPCell.BackgroundColor = BaseColor.WHITE; _pdfPCell.ExtraParagraphSpace = 0; _pdfPTable.AddCell(_pdfPCell); _pdfPTable.CompleteRow(); _fontStyle = FontFactory.GetFont("Calibri", 10f, 0); _pdfPCell = new PdfPCell(new Phrase(vm.Title, _fontStyle)); _pdfPCell.Colspan = 4; _pdfPCell.HorizontalAlignment = Element.ALIGN_LEFT; _pdfPCell.Border = 0; _pdfPCell.BackgroundColor = BaseColor.WHITE; _pdfPCell.ExtraParagraphSpace = 0; _pdfPTable.AddCell(_pdfPCell); _fontStyle = FontFactory.GetFont("Calibri", 10f, 0); _pdfPCell = new PdfPCell(new Phrase("3.59/4.00", _fontStyle)); _pdfPCell.Colspan = 2; _pdfPCell.HorizontalAlignment = Element.ALIGN_RIGHT; _pdfPCell.Border = 0; _pdfPCell.BackgroundColor = BaseColor.WHITE; _pdfPCell.ExtraParagraphSpace = 0; _pdfPTable.AddCell(_pdfPCell); _pdfPTable.CompleteRow(); NewLine(); }
public PartialViewResult EducationPartial(EducationVM education) { education.ListOfCountry = GetCountries(); return(PartialView("~/Views/Shared/_MyEducation.cshtml", education)); }
public ActionResult Education(EducationVM education) { return(View()); }