public int AddNewCv(string cvName, string cvIndustry, string cvLang) { tblUserCvDetail model = new tblUserCvDetail(); // if (Session["UserId"] == null) //return RedirectToAction("Login", "Home"); model.UserId = Convert.ToInt32(Session["UserId"]); model.CvName = cvName; model.Language = cvLang; model.Industry = cvIndustry; DateTime currentAccessedDateTime = DateTime.Now; model.LastModificationDateTime = currentAccessedDateTime; dbEntities.tblUserCvDetails.Add(model); //dbEntities.Entry(model).GetDatabaseValues(); dbEntities.SaveChanges(); //Session["CvId"] = model.CvId; int CvId = model.CvId; tblCvBasicInformation modelBasicInfo = new tblCvBasicInformation(); modelBasicInfo.CvId = CvId; dbEntities.tblCvBasicInformations.Add(modelBasicInfo); tblEducationDetail modelEdu = new tblEducationDetail(); modelEdu.CvId = CvId; dbEntities.tblEducationDetails.Add(modelEdu); tblInterestDetail modelInterest = new tblInterestDetail(); modelInterest.CvId = CvId; dbEntities.tblInterestDetails.Add(modelInterest); tblObjective modelObjective = new tblObjective(); modelObjective.CvId = CvId; dbEntities.tblObjectives.Add(modelObjective); tblQualification modelQualification = new tblQualification(); modelQualification.CvId = CvId; dbEntities.tblQualifications.Add(modelQualification); tblReferencesDetail modelReferences = new tblReferencesDetail(); modelReferences.Cvid = CvId; dbEntities.tblReferencesDetails.Add(modelReferences); tblWorkExperienceDetail modelExperience = new tblWorkExperienceDetail(); modelExperience.CvId = CvId; dbEntities.tblWorkExperienceDetails.Add(modelExperience); return(dbEntities.SaveChanges());; }
public int DeleteCv(string cvId) { tblUserCvDetail cvDetail = dbEntities.tblUserCvDetails.Find(int.Parse(cvId)); dbEntities.SP_DeleteCvBasicInformationByCvId(int.Parse(cvId)); dbEntities.SP_DeleteCvEducationDetailsByCvId(int.Parse(cvId)); dbEntities.SP_DeleteCvInterestDetailsByCvId(int.Parse(cvId)); dbEntities.SP_DeleteCvObjectiveDetailsByCvId(int.Parse(cvId)); dbEntities.SP_DeleteCvQualificationsDetailsByCvId(int.Parse(cvId)); dbEntities.SP_DeleteCvReferencesDetailsByCvId(int.Parse(cvId)); dbEntities.SP_DeleteCvWorkExperienceDetailsByCvId(int.Parse(cvId)); dbEntities.SaveChanges(); dbEntities.tblUserCvDetails.Remove(cvDetail); return(dbEntities.SaveChanges()); }
//public int AddNewObjective() //{ // tblWorkExperienceDetail model = new tblWorkExperienceDetail(); // //if (Session["UserId"] == null || Session["CvId"] == null) // // return RedirectToAction("Login", "Home"); // model.CvId = Convert.ToInt32(Session["CvId"]); // dbEntities.tblWorkExperienceDetails.Add(model); // return dbEntities.SaveChanges(); //} public int EditCv(string cvIdEdit, string cvNameEdit, string cvIndustryEdit, string cvLangEdit) { tblUserCvDetail model = dbEntities.tblUserCvDetails.Find(int.Parse(cvIdEdit)); // if (Session["UserId"] == null) //return RedirectToAction("Login", "Home"); model.CvName = cvNameEdit; model.Language = cvIndustryEdit; model.Industry = cvLangEdit; DateTime currentAccessedDateTime = DateTime.Now; model.LastModificationDateTime = currentAccessedDateTime; return(dbEntities.SaveChanges()); }