public ActionResult CreateEducation() { Profile_Education profile_educations = new Profile_Education(); return PartialView("EditProfileEducationView", profile_educations); }
public ActionResult SaveEducation(Profile_Education profile_education) { userId = User.Identity.Name; profile_education.UserId = userId; if (ModelState.IsValid) { if (profile_education.ProfileEducationId == Guid.Empty) { profile_education.ProfileEducationId = Guid.NewGuid(); //db.Profile_Education.AddObject(profile_education); db.Profile_Education.Add(profile_education); db.SaveChanges(); //Mapping Guid objectId = db.Profile_Basic.Where(x => x.UserId == profile_education.UserId).SingleOrDefault().ProfileBasicId; TagAttributeMappingManager mapping = new TagAttributeMappingManager(); mapping.AddRootAttribute(objectId, profile_education.UserId, "JobSeekerProfile"); mapping.AddSecondLevelAttribute(objectId, "Education Experience", "JobSeekerProfile"); mapping.AddThirdLevelAttribute(profile_education, objectId, "JobSeekerProfile", "Profile.Education"); } else { db.Profile_Education.Attach(profile_education); //db.ObjectStateManager.ChangeObjectState(profile_education, EntityState.Modified); db.Entry(profile_education).State = EntityState.Modified; db.SaveChanges(); //Mapping Guid objectId = db.Profile_Basic.Where(x => x.UserId == profile_education.UserId).SingleOrDefault().ProfileBasicId; TagAttributeMappingManager mapping = new TagAttributeMappingManager(); mapping.AddRootAttribute(objectId, profile_education.UserId, "JobSeekerProfile"); mapping.AddSecondLevelAttribute(objectId, "Education Experience", "JobSeekerProfile"); mapping.AddThirdLevelAttribute(profile_education, objectId, "JobSeekerProfile", "Profile.Education"); } } var listProfileEducation = db.Profile_Education.Where(x => x.UserId == userId); return PartialView("ListProfileEducationView", listProfileEducation); }