Exemplo n.º 1
0
        public ActionResult Basic()
        {
            string userId = User.Identity.Name;

            if (db.Profile_Basic.Where(x => x.UserId == userId).Count() != 1)
            {
                Profile_Basic profile_basic = new Profile_Basic();
                ViewBag.City = new SelectList(new City { }.GetCities, profile_basic.City);
                ViewBag.Country = new SelectList(new Countries { }.GetCountries, profile_basic.Country);
                ViewBag.Gender = new SelectList(new Genders { }.GetGenders, profile_basic.Gender);
                ViewBag.MaritalStatus = new SelectList(new MaritalStatus().MaritalStatusList, profile_basic.MaritalStatus);

                return View(profile_basic);
            }
            else
            {
                Profile_Basic profile_basic = db.Profile_Basic.Single(p => p.UserId == userId);
                ViewBag.City = new SelectList(new City { }.GetCities, profile_basic.City);
                ViewBag.Country = new SelectList(new Countries { }.GetCountries, profile_basic.Country);
                ViewBag.Gender = new SelectList(new Genders { }.GetGenders, profile_basic.Gender);
                ViewBag.MaritalStatus = new SelectList(new MaritalStatus().MaritalStatusList, profile_basic.MaritalStatus);

                return View(profile_basic);
            }
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
 public void SaveProfileBasic(Profile_Basic profile_basic)
 {
     _repository.SaveProfileBasic(profile_basic);
 }
Exemplo n.º 5
0
 public void SaveProfileBasic(Profile_Basic profile_basic)
 {
     _entities.Profile_Basic.Attach(profile_basic);
     _entities.ObjectStateManager.ChangeObjectState(profile_basic, EntityState.Modified);
     _entities.SaveChanges();
 }