public ActionResult ManagementAcountEmployee() { if (Session["IdUser"] == null && Session["EmailUser"] == null) { return(RedirectToAction("LoginForm", "Login")); } var idAcount = int.Parse(Session["IdUser"].ToString()); var dataCity = (from data in db.States join datatext in db.StateTexts on data.name_id equals datatext.id where datatext.language_id == "vi" && data.state_id != 59 && data.state_id != 28 select new GeoModel { CityId = data.state_id, CityName = datatext.text }).ToList(); dataCity.Insert(0, new GeoModel { CityId = 0, CityName = "Chọn thành/phố" }); dataCity.Insert(1, new GeoModel { CityId = 59, CityName = "TP.Hồ Chí Minh" }); dataCity.Insert(2, new GeoModel { CityId = 28, CityName = "TP.Hà Nội" }); var dataDist = (from data in db.Districts join datatext in db.DistrictTexts on data.name_id equals datatext.id where datatext.language_id == "vi" select new GeoModel { DistId = data.district_id, DistName = datatext.text }).ToList(); dataCity.Insert(0, new GeoModel { CityId = 0, CityName = "Chọn thành/phố" }); dataDist.Insert(0, new GeoModel { DistId = 0, DistName = "Chọn quận/huyện" }); CaptCha cap = new CaptCha(); BDSNew BDSNew = new BDSNew(); var register = new RegisterInformationModel { ListBDSScopes = db.BDSScopes.ToList(), ListMarriea = db.BDSMarriages.ToList(), ListSalary = db.BDSSalaries.ToList(), ListDucation = db.BDSEducations.ToList(), ListBDSCareer = db.BDSCareers.ToList(), ListTimework = db.BDSTimeWorks.ToList(), ListBDSLanguage = db.BDSLanguages.ToList(), ListBDSNewsType = db.BDSNewsTypes.OrderBy(x => x.Order).ToList(), ListGeoModel = dataCity.ToList(), ListGeoDisModel = dataDist.ToList(), tblCaptCha = cap, tblBDSNew = BDSNew, TblBDSEmployerInformation = db.BDSEmployerInformations.FirstOrDefault(x => x.IdAccount == idAcount), TblBDSPersonalInformation = db.BDSPersonalInformations.FirstOrDefault(x => x.IdAccount == idAcount), TblBdsAdcount = db.BDSAccounts.FirstOrDefault(x => x.ID == idAcount), ListBDSEmper = db.BDSEmpers.ToList() }; return(View(register)); }
public ActionResult DeleteAdvert(int idAdvert) { BDSNew tblNew = db.BDSNews.Find(idAdvert); db.BDSNews.Remove(tblNew); db.SaveChanges(); return(RedirectToAction("ListNewOfUser", "Management")); }
// // GET: /Register/ public ActionResult RegisterCompany() { CaptCha cap = new CaptCha(); BDSNew BDSNew = new BDSNew(); var dataCity = (from data in db.States join datatext in db.StateTexts on data.name_id equals datatext.id where datatext.language_id == "vi" && data.state_id != 59 && data.state_id != 28 select new GeoModel { CityId = data.state_id, CityName = datatext.text }).ToList(); dataCity.Insert(0, new GeoModel { CityId = 0, CityName = "Chọn thành/phố" }); dataCity.Insert(1, new GeoModel { CityId = 59, CityName = "TP.Hồ Chí Minh" }); dataCity.Insert(2, new GeoModel { CityId = 28, CityName = "TP.Hà Nội" }); var dataDist = (from data in db.Districts join datatext in db.DistrictTexts on data.name_id equals datatext.id where datatext.language_id == "vi" select new GeoModel { DistId = data.district_id, DistName = datatext.text }).ToList(); dataDist.Insert(0, new GeoModel { DistId = 0, DistName = "Chọn quận/huyện" }); var registerModel = new RegisterInformationModel { ListBDSScopes = db.BDSScopes.Where(x => x.Active == 1).ToList(), ListMarriea = db.BDSMarriages.Where(x => x.Active == 1).ToList(), ListSalary = db.BDSSalaries.Where(x => x.Active == 1).ToList(), ListDucation = db.BDSEducations.Where(x => x.Active == 1).ToList(), ListBDSCareer = db.BDSCareers.Where(x => x.Active == 1).ToList(), ListTimework = db.BDSTimeWorks.Where(x => x.Active == 1).ToList(), ListBDSLanguage = db.BDSLanguages.Where(x => x.Active == 1).ToList(), ListBDSNewsType = db.BDSNewsTypes.Where(x => x.Active == 1).OrderBy(x => x.Order).ToList(), ListGeoModel = dataCity.ToList(), ListGeoDisModel = dataDist.ToList(), tblCaptCha = cap, tblBDSNew = BDSNew, ListBDSEmployerInformation = db.BDSEmployerInformations.ToList(), ListBDSPersonalInformation = db.BDSPersonalInformations.ToList(), ListBdsAdcount = db.BDSAccounts.ToList(), ListBDSEmper = db.BDSEmpers.ToList() }; return(View(registerModel)); }
public ActionResult EditNews(string id) { var id_ = int.Parse(id.Split('-').Last()); var dataCity = (from data in db.States join datatext in db.StateTexts on data.name_id equals datatext.id where datatext.language_id == "vi" && data.state_id != 59 && data.state_id != 28 select new GeoModel { CityId = data.state_id, CityName = datatext.text }).ToList(); dataCity.Insert(0, new GeoModel { CityId = 0, CityName = "Chọn thành/phố" }); dataCity.Insert(1, new GeoModel { CityId = 59, CityName = "TP.Hồ Chí Minh" }); dataCity.Insert(2, new GeoModel { CityId = 28, CityName = "TP.Hà Nội" }); CaptCha cap = new CaptCha(); BDSNew BDSNew = new BDSNew(); var registerModel = new RegisterInformationModel { ListBDSScopes = db.BDSScopes.ToList(), ListMarriea = db.BDSMarriages.ToList(), ListSalary = db.BDSSalaries.ToList(), ListDucation = db.BDSEducations.ToList(), ListBDSCareer = db.BDSCareers.ToList(), ListTimework = db.BDSTimeWorks.ToList(), ListBDSLanguage = db.BDSLanguages.ToList(), ListBDSNewsType = db.BDSNewsTypes.OrderBy(x => x.Order).ToList(), ListGeoModel = dataCity.ToList(), tblCaptCha = cap, tblBDSNew = db.BDSNews.FirstOrDefault(x => x.ID == id_), ListBDSEmployerInformation = db.BDSEmployerInformations.ToList(), ListBdsAdcount = db.BDSAccounts.ToList(), ListBDSEmper = db.BDSEmpers.ToList(), ListBDSPicture = db.BDSPictures.Where(x => x.advert_id == id_).ToList() }; return(View(registerModel)); }
public ActionResult RegisterCompany(RegisterInformationModel bdsInformationModel) { bdsInformationModel.Status = false; try { bdsInformationModel.Status = false; if (Session["Captcha"] == null || Session["Captcha"].ToString() != bdsInformationModel.tblCaptCha.Captcha) { CaptCha cap = new CaptCha(); BDSNew BDSNew = new BDSNew(); var dataCity = (from data in db.States join datatext in db.StateTexts on data.name_id equals datatext.id where datatext.language_id == "vi" && data.state_id != 59 && data.state_id != 28 select new GeoModel { CityId = data.state_id, CityName = datatext.text }).ToList(); dataCity.Insert(0, new GeoModel { CityId = 0, CityName = "Chọn thành/phố" }); dataCity.Insert(1, new GeoModel { CityId = 59, CityName = "TP.Hồ Chí Minh" }); dataCity.Insert(2, new GeoModel { CityId = 28, CityName = "TP.Hà Nội" }); var dataDist = (from data in db.Districts join datatext in db.DistrictTexts on data.name_id equals datatext.id where datatext.language_id == "vi" select new GeoModel { DistId = data.district_id, DistName = datatext.text }).ToList(); dataDist.Insert(0, new GeoModel { DistId = 0, DistName = "Chọn quận/huyện" }); bdsInformationModel = new RegisterInformationModel { ListBDSScopes = db.BDSScopes.ToList(), ListMarriea = db.BDSMarriages.ToList(), ListSalary = db.BDSSalaries.ToList(), ListDucation = db.BDSEducations.ToList(), ListBDSCareer = db.BDSCareers.ToList(), ListTimework = db.BDSTimeWorks.ToList(), ListBDSLanguage = db.BDSLanguages.ToList(), ListBDSNewsType = db.BDSNewsTypes.OrderBy(x => x.Order).ToList(), ListGeoModel = dataCity.ToList(), ListGeoDisModel = dataCity.ToList(), tblCaptCha = cap, tblBDSNew = BDSNew, ListBDSEmployerInformation = db.BDSEmployerInformations.ToList(), ListBDSPersonalInformation = db.BDSPersonalInformations.ToList(), ListBdsAdcount = db.BDSAccounts.ToList(), ListBDSEmper = db.BDSEmpers.ToList(), Status = false, Msg = "Mã an toàn không đúng. Vui lòng nhập lại !" }; } else { bdsInformationModel.TblBdsAdcount.CreateDate = DateTime.Now; bdsInformationModel.TblBdsAdcount.CreateUser = 1; bdsInformationModel.TblBdsAdcount.Active = 1; bdsInformationModel.TblBdsAdcount.Money = 0; bdsInformationModel.TblBdsAdcount.Point = 0; bdsInformationModel.TblBdsAdcount.MailActive = 0; bdsInformationModel.TblBdsAdcount.Token = Guid.NewGuid().ToString(); db.Entry(bdsInformationModel.TblBdsAdcount).State = EntityState.Added; db.SaveChanges(); BDSEmployerInformation tblemployee = new BDSEmployerInformation(); bdsInformationModel.TblBDSEmployerInformation.IdAccount = bdsInformationModel.TblBdsAdcount.ID; bdsInformationModel.TblBDSEmployerInformation.Active = 1; bdsInformationModel.TblBDSEmployerInformation.CreateDate = DateTime.Now; bdsInformationModel.TblBDSEmployerInformation.CreateUser = 1; bdsInformationModel.TblBDSEmployerInformation.ModifiedDate = DateTime.Now; bdsInformationModel.TblBDSEmployerInformation.ModifiedUser = 1; bdsInformationModel.TblBDSEmployerInformation.Featured = 0; bdsInformationModel.TblBDSEmployerInformation.PhoneContact = bdsInformationModel.TblBDSEmployerInformation.Phone; bdsInformationModel.TblBDSEmployerInformation.DistrictContact = bdsInformationModel.TblBDSEmployerInformation.District; bdsInformationModel.TblBDSEmployerInformation.City = bdsInformationModel.TblBDSEmployerInformation.City; bdsInformationModel.TblBDSEmployerInformation.AddressContact = bdsInformationModel.TblBDSEmployerInformation.Address; bdsInformationModel.TblBDSEmployerInformation.EmailContact = bdsInformationModel.TblBdsAdcount.Email; bdsInformationModel.TblBDSEmployerInformation.TypeContact = 1; bdsInformationModel.TblBDSEmployerInformation.IdAccount = bdsInformationModel.TblBdsAdcount.ID; db.Entry(bdsInformationModel.TblBDSEmployerInformation).State = EntityState.Added; db.SaveChanges(); bdsInformationModel.Status = true; bdsInformationModel.Msg = "Tạo tài khoản thành công.Vui lòng kiểm tra email để kích hoạt tài khoản!"; SendTemplateEmail(bdsInformationModel.TblBdsAdcount.Email, bdsInformationModel.TblBdsAdcount.Email, bdsInformationModel.TblBdsAdcount.Token, "Email kích hoạt tài khoản", 1); } } catch (DbEntityValidationException e) { foreach (var eve in e.EntityValidationErrors) { Console.WriteLine("Entity of type \"{0}\" in State \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State); foreach (var ve in eve.ValidationErrors) { Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage); } } bdsInformationModel.Status = false; bdsInformationModel.Msg = "Tạo tài khoản thất bại!"; } return(Json(bdsInformationModel)); }
public ActionResult RegisterPersonal(RegisterInformationModel bdsInformationModel) { bdsInformationModel.Status = false; try { if (Session["Captcha"] == null || Session["Captcha"].ToString() != bdsInformationModel.tblCaptCha.Captcha) { CaptCha cap = new CaptCha(); BDSNew BDSNew = new BDSNew(); var dataCity = (from data in db.States join datatext in db.StateTexts on data.name_id equals datatext.id where datatext.language_id == "vi" && data.state_id != 59 && data.state_id != 28 select new GeoModel { CityId = data.state_id, CityName = datatext.text }).ToList(); dataCity.Insert(0, new GeoModel { CityId = 0, CityName = "Chọn thành/phố" }); dataCity.Insert(1, new GeoModel { CityId = 59, CityName = "TP.Hồ Chí Minh" }); dataCity.Insert(2, new GeoModel { CityId = 28, CityName = "TP.Hà Nội" }); bdsInformationModel = new RegisterInformationModel { ListBDSScopes = db.BDSScopes.ToList(), ListMarriea = db.BDSMarriages.ToList(), ListSalary = db.BDSSalaries.ToList(), ListDucation = db.BDSEducations.ToList(), ListBDSCareer = db.BDSCareers.ToList(), ListTimework = db.BDSTimeWorks.ToList(), ListBDSLanguage = db.BDSLanguages.ToList(), ListBDSNewsType = db.BDSNewsTypes.OrderBy(x => x.Order).ToList(), ListGeoModel = dataCity.ToList(), tblCaptCha = cap, tblBDSNew = BDSNew, ListBDSEmployerInformation = db.BDSEmployerInformations.ToList(), ListBDSPersonalInformation = db.BDSPersonalInformations.ToList(), ListBdsAdcount = db.BDSAccounts.ToList(), ListBDSEmper = db.BDSEmpers.ToList(), Status = false, Msg = "Mã an toàn không đúng. Vui lòng nhập lại !" }; } else { bdsInformationModel.TblBdsAdcount.CreateDate = DateTime.Now; bdsInformationModel.TblBdsAdcount.CreateUser = 1; bdsInformationModel.TblBdsAdcount.Active = 1; bdsInformationModel.TblBdsAdcount.Money = 0; bdsInformationModel.TblBdsAdcount.Point = 0; bdsInformationModel.TblBdsAdcount.MailActive = 0; bdsInformationModel.TblBdsAdcount.Token = Guid.NewGuid().ToString(); db.Entry(bdsInformationModel.TblBdsAdcount).State = EntityState.Added; db.SaveChanges(); bdsInformationModel.TblBDSPersonalInformation.IdAccount = bdsInformationModel.TblBdsAdcount.ID; bdsInformationModel.TblBDSPersonalInformation.Active = 1; bdsInformationModel.TblBDSPersonalInformation.CreateDate = DateTime.Now; bdsInformationModel.TblBDSPersonalInformation.ModifiedDate = DateTime.Now; bdsInformationModel.TblBDSPersonalInformation.CreateUser = 1; bdsInformationModel.TblBDSPersonalInformation.ModifiedUser = 1; db.Entry(bdsInformationModel.TblBDSPersonalInformation).State = EntityState.Added; db.SaveChanges(); bdsInformationModel.tblBDSPerNew.Status = 0; bdsInformationModel.tblBDSPerNew.Active = 1; bdsInformationModel.tblBDSPerNew.CreateDate = DateTime.Now; bdsInformationModel.tblBDSPerNew.CreateUser = 1; bdsInformationModel.tblBDSPerNew.CreateUser = 1; bdsInformationModel.tblBDSPerNew.PerId = bdsInformationModel.TblBDSPersonalInformation.ID; bdsInformationModel.tblBDSPerNew.ProvinceProfile = bdsInformationModel.TblBDSPersonalInformation.Province; db.Entry(bdsInformationModel.tblBDSPerNew).State = EntityState.Added; db.SaveChanges(); bdsInformationModel.Status = true; bdsInformationModel.Msg = "Tạo tài khoản thành công.Vui lòng kiểm tra email để kích hoạt tài khoản!"; SendTemplateEmail(bdsInformationModel.TblBdsAdcount.Email, bdsInformationModel.TblBdsAdcount.Email, bdsInformationModel.TblBdsAdcount.Token, "Email kích hoạt tài khoản", 1); } } catch (Exception) { bdsInformationModel.Status = false; bdsInformationModel.Msg = "Tạo tài khoản thất bại!"; } return(Json(bdsInformationModel)); }
public ActionResult EditNews(RegisterInformationModel create, HttpPostedFileBase[] files, int[] img_id) { if (Session["Captcha"] == null || Session["Captcha"].ToString() != create.tblCaptCha.Captcha) { ModelState.AddModelError("Captcha", "Wrong value of sum, please try again."); var dataCity = (from data in db.States join datatext in db.StateTexts on data.name_id equals datatext.id where datatext.language_id == "vi" && data.state_id != 59 && data.state_id != 28 select new GeoModel { CityId = data.state_id, CityName = datatext.text }).ToList(); dataCity.Insert(0, new GeoModel { CityId = 0, CityName = "Chọn thành/phố" }); dataCity.Insert(1, new GeoModel { CityId = 59, CityName = "TP.Hồ Chí Minh" }); dataCity.Insert(2, new GeoModel { CityId = 28, CityName = "TP.Hà Nội" }); CaptCha cap = new CaptCha(); BDSNew BDSNew = new BDSNew(); var registerModel = new RegisterInformationModel { ListBDSScopes = db.BDSScopes.ToList(), ListMarriea = db.BDSMarriages.ToList(), ListSalary = db.BDSSalaries.ToList(), ListDucation = db.BDSEducations.ToList(), ListBDSCareer = db.BDSCareers.ToList(), ListTimework = db.BDSTimeWorks.ToList(), ListBDSLanguage = db.BDSLanguages.ToList(), ListBDSNewsType = db.BDSNewsTypes.OrderBy(x => x.Order).ToList(), ListGeoModel = dataCity.ToList(), tblCaptCha = cap, tblBDSNew = db.BDSNews.FirstOrDefault(x => x.ID == create.tblBDSNew.ID), ListBDSEmployerInformation = db.BDSEmployerInformations.ToList(), ListBdsAdcount = db.BDSAccounts.ToList(), ListBDSEmper = db.BDSEmpers.ToList(), ListBDSPicture = db.BDSPictures.Where(x => x.advert_id == create.tblBDSNew.ID).ToList() }; return(View(registerModel)); } else { BDSNew tblNews = db.BDSNews.Find(create.tblBDSNew.ID); tblNews.Title = create.tblBDSNew.Title; tblNews.AddressWork = create.tblBDSNew.AddressWork; tblNews.FromSalary = create.tblBDSNew.FromSalary; tblNews.ToSalary = create.tblBDSNew.ToSalary; tblNews.Quantity = create.tblBDSNew.Quantity; tblNews.Bonus = create.tblBDSNew.Bonus; tblNews.Sex = create.tblBDSNew.Sex; tblNews.IdTimeWork = create.tblBDSNew.IdTimeWork; tblNews.IdEducation = create.tblBDSNew.IdEducation; tblNews.Career = create.tblBDSNew.Career; tblNews.DesCompany = create.tblBDSNew.DesCompany; tblNews.DesWork = create.tblBDSNew.DesWork; tblNews.Benefit = create.tblBDSNew.Benefit; tblNews.FromAge = create.tblBDSNew.FromAge; tblNews.ToAge = create.tblBDSNew.ToAge; tblNews.TimeProbationary = create.tblBDSNew.TimeProbationary; tblNews.NameCompany = create.tblBDSNew.NameCompany; tblNews.AddressApply = create.tblBDSNew.AddressApply; tblNews.NamesContact = create.tblBDSNew.NamesContact; tblNews.PhoneContact = create.tblBDSNew.PhoneContact; tblNews.Email = create.tblBDSNew.Email; tblNews.FromDeadline = create.tblBDSNew.FromDeadline; tblNews.ToDeadline = create.tblBDSNew.ToDeadline; tblNews.IdLanguage = create.tblBDSNew.IdLanguage; tblNews.WebSiteCompany = create.tblBDSNew.WebSiteCompany; tblNews.UrlImage = create.tblBDSNew.UrlImage; tblNews.Career = tblNews.Career.Substring(tblNews.Career.Length - 1) == "," ? tblNews.Career.Substring(0, tblNews.Career.Length - 1) : tblNews.Career; db.Entry(tblNews).State = EntityState.Modified; db.SaveChanges(); if (img_id != null && img_id.Length > 0) { var listPic = db.BDSPictures.Where(T => T.advert_id == tblNews.ID && !img_id.Contains(T.ID)).ToList(); foreach (var pic in listPic) { db.Entry(pic).State = EntityState.Deleted; } } if (files != null && files.Length > 0) { for (int i = 0; i < files.Length; i++) { if (files[i] != null) { byte[] binaryData; binaryData = new Byte[files[i].InputStream.Length]; long bytesRead = files[i].InputStream.Read(binaryData, 0, (int)files[i].InputStream.Length); files[i].InputStream.Close(); string base64String = System.Convert.ToBase64String(binaryData, 0, binaryData.Length); SaveImg(new NewsPicture { nameImg = files[i].FileName, idProducts = create.tblBDSNew.ID, isactive = 1, index = i, cfile = base64String }); } } } db.SaveChanges(); var listMap = db.BDSNews_Career.Where(T => T.ID_News == tblNews.ID).ToList(); foreach (var item in listMap) { db.Entry(item).State = EntityState.Deleted; } db.SaveChanges(); foreach (var item in create.tblBDSNew.Career.Split(',')) { if (!String.IsNullOrEmpty(item)) { BDSNews_Career i = new BDSNews_Career { ID_News = create.tblBDSNew.ID, ID_Career = int.Parse(item) }; db.Entry(i).State = EntityState.Added; } } db.SaveChanges(); return(RedirectToAction("ListNewOfUser", "Management")); } return(null); }
// // GET: /Adverts/ public ActionResult AdvertCompany() { if (Session["IdUser"] == null && Session["EmailUser"] == null) { return(RedirectToAction("LoginForm", "Login")); } int idAccount = (int)Session["IdUser"]; var dataCity = (from data in db.States join datatext in db.StateTexts on data.name_id equals datatext.id where datatext.language_id == "vi" && data.state_id != 59 && data.state_id != 28 select new GeoModel { CityId = data.state_id, CityName = datatext.text }).ToList(); dataCity.Insert(0, new GeoModel { CityId = 0, CityName = "Chọn thành/phố" }); dataCity.Insert(1, new GeoModel { CityId = 59, CityName = "TP.Hồ Chí Minh" }); dataCity.Insert(2, new GeoModel { CityId = 28, CityName = "TP.Hà Nội" }); if (!db.BDSEmployerInformations.Select(x => x.IdAccount).ToList().Contains(idAccount)) { return(RedirectToAction("Warning", "Adverts")); } var TblBDSEmployerInformation = db.BDSEmployerInformations.First(T => T.IdAccount == idAccount); CaptCha cap = new CaptCha(); BDSNew BDSNew = new BDSNew { CreateUser = 1, Active = 1, CreateDate = DateTime.Now, DateReup = null, IdLanguage = 1, FromCreateNews = DateTime.Now, ToCreateNews = DateTime.Now.AddDays(3), FromDeadline = DateTime.Now, ToDeadline = DateTime.Now.AddDays(30), NameCompany = TblBDSEmployerInformation.Name, AddressApply = TblBDSEmployerInformation.AddressContact, NamesContact = TblBDSEmployerInformation.NameContact, Email = TblBDSEmployerInformation.EmailContact, WebSiteCompany = TblBDSEmployerInformation.WebSite }; var registerModel = new RegisterInformationModel { ListBDSScopes = db.BDSScopes.Where(T => T.Active == 1).ToList(), ListMarriea = db.BDSMarriages.Where(T => T.Active == 1).ToList(), ListSalary = db.BDSSalaries.Where(T => T.Active == 1).ToList(), ListDucation = db.BDSEducations.Where(T => T.Active == 1).ToList(), ListBDSCareer = db.BDSCareers.Where(T => T.Active == 1).ToList(), ListTimework = db.BDSTimeWorks.Where(T => T.Active == 1).ToList(), ListBDSLanguage = db.BDSLanguages.Where(T => T.Active == 1).ToList(), ListBDSNewsType = db.BDSNewsTypes.Where(T => T.Active == 1).OrderBy(x => x.Order).ToList(), ListGeoModel = dataCity.ToList(), tblCaptCha = cap, tblBDSNew = BDSNew, TblBDSEmployerInformation = TblBDSEmployerInformation }; return(View(registerModel)); }
public ActionResult ManagementAcountPersonal(RegisterInformationModel register) { if (Session["IdUser"] == null && Session["EmailUser"] == null) { return(RedirectToAction("LoginForm", "Login")); } var idAcount = int.Parse(Session["IdUser"].ToString()); BDSAccount TblBdsAdcount = db.BDSAccounts.Find(idAcount); TblBdsAdcount.Email = register.TblBdsAdcount.Email; db.Entry(TblBdsAdcount).State = EntityState.Modified; db.SaveChanges(); var idEmployee = db.BDSPersonalInformations.FirstOrDefault(x => x.IdAccount == idAcount); if (idEmployee != null) { BDSPersonalInformation BDSPersonalInformation = db.BDSPersonalInformations.Find(idEmployee.ID); BDSPersonalInformation.Name = register.TblBDSPersonalInformation.Name; BDSPersonalInformation.TemporaryAddress = register.TblBDSPersonalInformation.TemporaryAddress; BDSPersonalInformation.Province = register.TblBDSPersonalInformation.Province; BDSPersonalInformation.PermanentAddress = register.TblBDSPersonalInformation.PermanentAddress; BDSPersonalInformation.Phone = register.TblBDSPersonalInformation.Phone; // BDSPersonalInformation.City = register.TblBDSPersonalInformation.City; BDSPersonalInformation.Description = register.TblBDSPersonalInformation.Description; BDSPersonalInformation.UrlImage = register.TblBDSPersonalInformation.UrlImage; db.Entry(BDSPersonalInformation).State = EntityState.Modified; db.SaveChanges(); } var dataCity = (from data in db.States join datatext in db.StateTexts on data.name_id equals datatext.id where datatext.language_id == "vi" && data.state_id != 59 && data.state_id != 28 select new GeoModel { CityId = data.state_id, CityName = datatext.text }).ToList(); dataCity.Insert(0, new GeoModel { CityId = 0, CityName = "Chọn thành/phố" }); dataCity.Insert(1, new GeoModel { CityId = 59, CityName = "TP.Hồ Chí Minh" }); dataCity.Insert(2, new GeoModel { CityId = 28, CityName = "TP.Hà Nội" }); CaptCha cap = new CaptCha(); BDSNew BDSNew = new BDSNew(); var register1 = new RegisterInformationModel { ListBDSScopes = db.BDSScopes.ToList(), ListMarriea = db.BDSMarriages.ToList(), ListSalary = db.BDSSalaries.ToList(), ListDucation = db.BDSEducations.ToList(), ListBDSCareer = db.BDSCareers.ToList(), ListTimework = db.BDSTimeWorks.ToList(), ListBDSLanguage = db.BDSLanguages.ToList(), ListBDSNewsType = db.BDSNewsTypes.OrderBy(x => x.Order).ToList(), ListGeoModel = dataCity.ToList(), tblCaptCha = cap, tblBDSNew = BDSNew, TblBDSPersonalInformation = db.BDSPersonalInformations.FirstOrDefault(x => x.IdAccount == idAcount), TblBdsAdcount = db.BDSAccounts.FirstOrDefault(x => x.ID == idAcount), ListBDSEmper = db.BDSEmpers.ToList() }; return(View(register1)); }