public ActionResult Index(string account) { var model = new AboutViewModel(); var repo = new Repository<UserModel>(DbCollection.User); var repoShare = new Repository<ShareSettingModel>(DbCollection.ShareSetting); var repoSystemShare = new Repository<SystemShareModel>(DbCollection.SystemShare); var repoEducation = new Repository<EducationModel>(DbCollection.Education); var repoExperience = new Repository<ExperienceModel>(DbCollection.Experience); var repoExperienceEmployment = new Repository<ExperienceEmploymentModel>(DbCollection.ExperienceEmployment); var repoContact = new Repository<ContactModel>(DbCollection.Contact); var repoContactType = new Repository<ContactTypeModel>(DbCollection.ContactType); var userId = !string.IsNullOrEmpty(account) ? account.Split('-').Last() : User.Identity.GetUserId(); var user = repo.GetById(userId); model.User = user; var share = new ShareViewModel { ShareSetting = repoShare.Gets().First(m => m.UserId.Equals(userId)), ListSystemShare = repoSystemShare.Gets().Where(m => m.Enable.Equals(true)).ToList() }; model.Share = share; model.ListEducation = repoEducation.Gets().Where(m => m.UserId.Equals(userId)).ToList(); model.Experience = repoExperience.Gets().FirstOrDefault(m => m.UserId.Equals(userId)) ?? new ExperienceModel(); model.ListExperienceEmployment = repoExperienceEmployment.Gets().Where(m => m.UserId.Equals(userId)).ToList(); model.ListContact = repoContact.Gets().Where(m => m.UserId.Equals(userId)).ToList(); model.ListContactType = repoContactType.Gets().ToList(); // Read or Edit model.Modify = userId == User.Identity.GetUserId(); model.FlIdUser = user.FirstName.UrlFriendly() + '-' + user.LastName.UrlFriendly() + "-" + user.Id; // Test Log Log.Error(new Exception("Test")); return View(model); }
public ActionResult SettingDetails() { var model = new AboutViewModel { User = GetOwnerUser() }; #region Share var share = new ShareViewModel(); var repoShare = new Repository<ShareSettingModel>(DbCollection.ShareSetting); var repoSystemShare = new Repository<SystemShareModel>(DbCollection.SystemShare); share.ShareSetting = repoShare.Gets().First(m => m.UserId.Equals(User.Identity.GetUserId())); share.ListSystemShare = repoSystemShare.Gets().Where(m => m.Enable.Equals(true)).ToList(); model.Share = share; #endregion return PartialView("_DetailsPartial", model); }
public ActionResult SettingDetails(AboutViewModel 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 }); }
public ActionResult SettingBasicInfo(AboutViewModel 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.Address = model.User.Address; 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 }); }