예제 #1
0
        public ActionResult Create(Profile_Basic profile_basic)
        {
            if (ModelState.IsValid)
            {
                profile_basic.ProfileBasicId = Guid.NewGuid();
                //db.Profile_Basic.AddObject(profile_basic);
                db.Profile_Basic.Add(profile_basic);
                db.SaveChanges();

                //Mapping
                Guid objectId = profile_basic.ProfileBasicId;
                TagAttributeMappingManager mapping = new TagAttributeMappingManager();
                mapping.AddRootAttribute(objectId, profile_basic.UserId, "JobSeekerProfile");
                mapping.AddSecondLevelAttribute(objectId, "Basic", "JobSeekerProfile");
                mapping.AddThirdLevelAttribute(profile_basic, objectId, "JobSeekerProfile", "Profile.Basic");

                return RedirectToAction("Index");
            }

            ViewBag.UserId = new SelectList(db.Users, "UserId", "Email", profile_basic.UserId);
            return View(profile_basic);
        }
예제 #2
0
        public ActionResult Basic(Profile_Basic profile_basic)
        {
            if (ModelState.IsValid)
            {
                if (profile_basic.ProfileBasicId != Guid.Empty)
                {
                    db.Profile_Basic.Attach(profile_basic);
                    //db.ObjectStateManager.ChangeObjectState(profile_basic, EntityState.Modified);
                    db.Entry(profile_basic).State = EntityState.Modified;
                    db.SaveChanges();

                    //Mapping
                    Guid objectId = profile_basic.ProfileBasicId;
                    TagAttributeMappingManager mapping = new TagAttributeMappingManager();
                    mapping.AddRootAttribute(objectId, profile_basic.UserId, "JobSeekerProfile");
                    mapping.AddSecondLevelAttribute(objectId, "Basic", "JobSeekerProfile");
                    mapping.AddThirdLevelAttribute(profile_basic, objectId, "JobSeekerProfile", "Profile.Basic");
                }
                else
                {
                    profile_basic.ProfileBasicId = Guid.NewGuid();
                    //db.Profile_Basic.AddObject(profile_basic);
                    db.Profile_Basic.Add(profile_basic);
                    db.SaveChanges();

                    //Mapping
                    Guid objectId = profile_basic.ProfileBasicId;
                    TagAttributeMappingManager mapping = new TagAttributeMappingManager();
                    mapping.AddRootAttribute(objectId, profile_basic.UserId, "JobSeekerProfile");
                    mapping.AddSecondLevelAttribute(objectId, "Basic", "JobSeekerProfile");
                    mapping.AddThirdLevelAttribute(profile_basic, objectId, "JobSeekerProfile", "Profile.Basic");
                }

                return RedirectToAction("Basic");
            }
            //ViewBag.UserId = new SelectList(db.Users, "UserId", "Email", profile_basic.UserId);
            return View(profile_basic);
        }
예제 #3
0
        public ActionResult SaveWork(Profile_Work profile_work)
        {
            userId = User.Identity.Name;
            profile_work.UserId = userId;

            if (ModelState.IsValid)
            {
                if (profile_work.ProfileWorkId == Guid.Empty)
                {
                    profile_work.ProfileWorkId = Guid.NewGuid();
                    //db.Profile_Work.AddObject(profile_work);
                    db.Profile_Work.Add(profile_work);
                    db.SaveChanges();

                    //Mapping
                    Guid objectId = db.Profile_Basic.Where(x => x.UserId == profile_work.UserId).SingleOrDefault().ProfileBasicId;
                    TagAttributeMappingManager mapping = new TagAttributeMappingManager();
                    mapping.AddRootAttribute(objectId, profile_work.UserId, "JobSeekerProfile");
                    mapping.AddSecondLevelAttribute(objectId, "Work Experience", "JobSeekerProfile");
                    mapping.AddThirdLevelAttribute(profile_work, objectId, "JobSeekerProfile", "Profile.Work");
                }
                else
                {
                    db.Profile_Work.Attach(profile_work);
                    //db.ObjectStateManager.ChangeObjectState(profile_work, EntityState.Modified);
                    db.Entry(profile_work).State = EntityState.Modified;
                    db.SaveChanges();

                    //Mapping
                    Guid objectId = db.Profile_Basic.Where(x=>x.UserId == profile_work.UserId).SingleOrDefault().ProfileBasicId;
                    TagAttributeMappingManager mapping = new TagAttributeMappingManager();
                    mapping.AddRootAttribute(objectId, profile_work.UserId, "JobSeekerProfile");
                    mapping.AddSecondLevelAttribute(objectId, "Work Experience", "JobSeekerProfile");
                    mapping.AddThirdLevelAttribute(profile_work, objectId, "JobSeekerProfile", "Profile.Work");
                }
            }
            var listProfileWork = db.Profile_Work.Where(x => x.UserId == userId);
            return PartialView("ListProfileWorkView", listProfileWork);
        }