예제 #1
0
 public ActionResult SettingFlName(UserModel model)
 {
     var repo = new Repository<UserModel>(DbCollection.User);
     var user = GetOwnerUser();
     user.FirstName = model.FirstName;
     user.LastName = model.LastName;
     user.Modified = DateTime.Now.ToString();
     repo.Update(user);
     return Json(new { result = true, model });
 }
예제 #2
0
        public ActionResult SettingEducation(SettingEducationPostViewModel model)
        {
            var repo = new Repository<EducationModel>(DbCollection.Education);
            if (model.ListEducation != null)
            {
                foreach (var item in model.ListEducation)
                {
                    item.UserId = User.Identity.GetUserId();
                    if (item.Id != new ObjectId("000000000000000000000000"))
                    {
                        repo.Update(item);
                    }
                    else
                    {
                        repo.Insert(item);
                    }
                }
            }

            // Delete
            if (!string.IsNullOrEmpty(model.Delete))
            {
                var listStrLineElements = model.Delete.Split(';').ToList();
                foreach (var itemDetail in listStrLineElements)
                {
                    repo.Delete(MyConstants.ConvertToObjectId(itemDetail));
                }
            }

            // Update ShareSetting
            var repoShare = new Repository<ShareSettingModel>(DbCollection.ShareSetting);
            var share = repoShare.Gets().First(m => m.UserId.Equals(User.Identity.GetUserId()));
            share.Education = model.ShareSetting.Education;
            repoShare.Update(share);
            return Json(new { result = true, model });
        }
예제 #3
0
        public ActionResult SettingExperience(SettingExperiencePostViewModel model)
        {
            var repo = new Repository<ExperienceModel>(DbCollection.Experience);
            var repoEmployment = new Repository<ExperienceEmploymentModel>(DbCollection.ExperienceEmployment);

            #region Experience
            var experience = repo.Gets().FirstOrDefault(m => m.UserId.Equals(User.Identity.GetUserId()));
            if (experience != null)
            {
                experience.Occupation = model.Experience.Occupation;
                experience.Skill = model.Experience.Skill;
                repo.Update(experience);
            }
            else
            {
                experience = new ExperienceModel
                {
                    UserId = User.Identity.GetUserId(),
                    Occupation = model.Experience.Occupation,
                    Skill = model.Experience.Skill
                };
                repo.Insert(experience);
            }
            #endregion

            if (model.ListExperienceEmployment != null)
            {
                foreach (var item in model.ListExperienceEmployment)
                {
                    item.UserId = User.Identity.GetUserId();
                    if (item.Id != new ObjectId("000000000000000000000000"))
                    {
                        repoEmployment.Update(item);
                    }
                    else
                    {
                        repoEmployment.Insert(item);
                    }
                }
            }

            // Delete
            if (!string.IsNullOrEmpty(model.Delete))
            {
                var listStrLineElements = model.Delete.Split(';').ToList();
                foreach (var itemDetail in listStrLineElements)
                {
                    repoEmployment.Delete(MyConstants.ConvertToObjectId(itemDetail));
                }
            }

            // Update ShareSetting
            var repoShare = new Repository<ShareSettingModel>(DbCollection.ShareSetting);
            var share = repoShare.Gets().First(m => m.UserId.Equals(User.Identity.GetUserId()));
            share.Occupation = model.ShareSetting.Occupation;
            share.Skill = model.ShareSetting.Skill;
            share.Employment = model.ShareSetting.Employment;
            repoShare.Update(share);
            return Json(new { result = true, model });
        }
예제 #4
0
        public ActionResult SettingDetails(SettingBasicPostViewModel model)
        {
            var repo = new Repository<UserModel>(DbCollection.User);
            var user = GetOwnerUser();
            user.Personal = true;
            user.AdditionalInfo = model.User.AdditionalInfo;
            user.Modified = DateTime.Now.ToString();
            repo.Update(user);

            // Update ShareSetting
            var repoShare = new Repository<ShareSettingModel>(DbCollection.ShareSetting);
            var share = repoShare.Gets().First(m => m.UserId.Equals(User.Identity.GetUserId()));
            share.Detail = model.ShareSetting.Detail;
            repoShare.Update(share);
            return Json(new { result = true, model });
        }
예제 #5
0
        public ActionResult SettingBusinessMoreInfo(SettingBusinessPostViewModel model)
        {
            var repo = new Repository<UserModel>(DbCollection.User);
            var user = GetOwnerUser();
            user.Business = true;
            user.BCompanyField = model.User.BCompanyField;
            user.BOverview = model.User.BOverview;
            repo.Update(user);

            // Update ShareSetting
            var repoShare = new Repository<ShareSettingModel>(DbCollection.ShareSetting);
            var share = repoShare.Gets().First(m => m.UserId.Equals(User.Identity.GetUserId()));
            share.BusinessCompanyName = model.ShareSetting.BusinessCompanyName;
            share.BusinessDateOfFormation = model.ShareSetting.BusinessDateOfFormation;
            share.BusinessRegistrationNo = model.ShareSetting.BusinessRegistrationNo;
            repoShare.Update(share);
            return Json(new { result = true, model });
        }
예제 #6
0
        public ActionResult SettingBusinessHeadOffice(SettingBusinessPostViewModel model)
        {
            var repo = new Repository<UserModel>(DbCollection.User);
            var user = GetOwnerUser();
            user.Business = true;
            user.BAddress = model.User.BAddress;
            user.BTelephone = model.User.BTelephone;
            user.BWebsite = model.User.BWebsite;
            user.BEmail = model.User.BEmail;
            user.BContactPerson = model.User.BContactPerson;
            repo.Update(user);

            // Update ShareSetting
            var repoShare = new Repository<ShareSettingModel>(DbCollection.ShareSetting);
            var share = repoShare.Gets().First(m => m.UserId.Equals(User.Identity.GetUserId()));
            share.BusinessCompanyName = model.ShareSetting.BusinessCompanyName;
            share.BusinessDateOfFormation = model.ShareSetting.BusinessDateOfFormation;
            share.BusinessRegistrationNo = model.ShareSetting.BusinessRegistrationNo;
            repoShare.Update(share);
            return Json(new { result = true, model });
        }
예제 #7
0
        public ActionResult SettingBasicInfo(SettingBasicPostViewModel model)
        {
            var repo = new Repository<UserModel>(DbCollection.User);
            var user = GetOwnerUser();
            user.Personal = true;
            user.Birthday = model.User.Birthday;
            user.Gender = model.User.Gender;
            user.NewGender = user.Gender == "Custom" ? model.User.NewGender : string.Empty;
            user.CountryId = model.User.CountryId;
            user.Country = model.User.Country;
            user.CityId = model.User.CityId;
            user.City = model.User.City;
            user.Modified = DateTime.Now.ToString();
            repo.Update(user);

            // Update ShareSetting
            var repoShare = new Repository<ShareSettingModel>(DbCollection.ShareSetting);
            var share = repoShare.Gets().First(m => m.UserId.Equals(User.Identity.GetUserId()));
            share.Birthday = model.ShareSetting.Birthday;
            share.Gender = model.ShareSetting.Gender;
            share.Country = model.ShareSetting.Country;
            share.City = model.ShareSetting.City;
            repoShare.Update(share);
            return Json(new { result = true, model });
        }
예제 #8
0
        public ActionResult SettingContact(SettingContactPostViewModel model)
        {
            var repo = new Repository<ContactModel>(DbCollection.Contact);
            if (model.ListContact != null)
            {
                foreach (var item in model.ListContact)
                {
                    item.UserId = User.Identity.GetUserId();
                    if (item.Id != new ObjectId("000000000000000000000000"))
                    {
                        // Delete if empty data
                        var isDelete = string.IsNullOrEmpty(item.Type);
                        if (!string.IsNullOrEmpty(item.Content))
                        {
                            isDelete = false;
                        }
                        if (isDelete)
                        {
                            repo.Delete(item.Id);
                        }
                        else
                        {
                            repo.Update(item);
                        }
                    }
                    else
                    {
                        repo.Insert(item);
                    }
                }
            }

            // Delete
            if (!string.IsNullOrEmpty(model.Delete))
            {
                var listStrLineElements = model.Delete.Split(';').ToList();
                foreach (var itemDetail in listStrLineElements)
                {
                    repo.Delete(MyConstants.ConvertToObjectId(itemDetail));
                }
            }

            // Update ShareSetting
            var repoShare = new Repository<ShareSettingModel>(DbCollection.ShareSetting);
            var share = repoShare.Gets().First(m => m.UserId.Equals(User.Identity.GetUserId()));
            share.ContactHome = model.ShareSetting.ContactHome;
            share.ContactWork = model.ShareSetting.ContactWork;
            repoShare.Update(share);
            return Json(new { result = true, model });
        }