public async Task <ActionResult> EditCV(EditCV model) { ViewBag.Name = new SelectList(context.Roles.Where(u => !u.Name.Contains("Nothing")) .ToList(), "Name", "Name"); if (!ModelState.IsValid) { return(View(model)); } var store = new UserStore <ApplicationUser>(new ApplicationDbContext()); var manager = new UserManager <ApplicationUser>(store); var currentUser = manager.FindByEmail(model.Email); currentUser.Email = model.Email; currentUser.Work_Title1 = model.Work_Title1; currentUser.Work_Title2 = model.Work_Title2; currentUser.Work_TItle3 = model.Work_TItle3; currentUser.Work_Name1 = model.Work_Name1; currentUser.Work_Name2 = model.Work_Name2; currentUser.Work_Name3 = model.Work_Name3; currentUser.Work_Description1 = model.Work_Description1; currentUser.Work_Description2 = model.Work_Description2; currentUser.Work_Description3 = model.Work_Description3; currentUser.Work_DateStart1 = model.Work_DateStart1; currentUser.Work_DateStart2 = model.Work_DateStart2; currentUser.Work_DateStart3 = model.Work_DateStart3; currentUser.Work_DateEnd1 = model.Work_DateEnd1; currentUser.Work_DateEnd2 = model.Work_DateEnd2; currentUser.Work_DateEnd3 = model.Work_DateEnd3; currentUser.Edu_Title1 = model.Edu_Title1; currentUser.Edu_Title2 = model.Edu_Title2; currentUser.Edu_Title3 = model.Edu_Title3; currentUser.Edu_School1 = model.Edu_School1; currentUser.Edu_School2 = model.Edu_School2; currentUser.Edu_School3 = model.Edu_School3; currentUser.Edu_Description1 = model.Edu_Description1; currentUser.Edu_Description2 = model.Edu_Description2; currentUser.Edu_Description3 = model.Edu_Description3; currentUser.Edu_DateStart1 = model.Edu_DateStart1; currentUser.Edu_DateStart2 = model.Edu_DateStart2; currentUser.Edu_DateStart3 = model.Edu_DateStart3; currentUser.Edu_DateEnd1 = model.Edu_DateEnd1; currentUser.Edu_DateEnd2 = model.Edu_DateEnd2; currentUser.Edu_DateEnd3 = model.Edu_DateEnd3; currentUser.Skill1 = model.Skill1; currentUser.Skill2 = model.Skill2; currentUser.Skill3 = model.Skill3; currentUser.Hobbies_Desc = model.Hobbies_Desc; currentUser.Visibility = model.Visibility; currentUser.Success = model.Success; currentUser.CV_Category = model.CV_Category; await manager.UpdateAsync(currentUser); var ctx = store.Context; ctx.SaveChanges(); TempData["msg"] = "CV Changes Saved !"; return(RedirectToAction("ListCV")); }
public ActionResult EditCV(string email) { ApplicationUser appUser = new ApplicationUser(); appUser = UserManager.FindByEmail(email); EditCV cv = new EditCV(); cv.Email = appUser.Email; cv.Work_Title1 = appUser.Work_Title1; cv.Work_Title2 = appUser.Work_Title2; cv.Work_TItle3 = appUser.Work_TItle3; cv.Work_Name1 = appUser.Work_Name1; cv.Work_Name2 = appUser.Work_Name2; cv.Work_Name3 = appUser.Work_Name3; cv.Work_Description1 = appUser.Work_Description1; cv.Work_Description2 = appUser.Work_Description2; cv.Work_Description3 = appUser.Work_Description3; cv.Work_DateStart1 = appUser.Work_DateStart1; cv.Work_DateStart2 = appUser.Work_DateStart2; cv.Work_DateStart3 = appUser.Work_DateStart3; cv.Work_DateEnd1 = appUser.Work_DateEnd1; cv.Work_DateEnd2 = appUser.Work_DateEnd2; cv.Work_DateEnd3 = appUser.Work_DateEnd3; cv.Edu_Title1 = appUser.Edu_Title1; cv.Edu_Title2 = appUser.Edu_Title2; cv.Edu_Title3 = appUser.Edu_Title3; cv.Edu_School1 = appUser.Edu_School1; cv.Edu_School2 = appUser.Edu_School2; cv.Edu_School3 = appUser.Edu_School3; cv.Edu_Description1 = appUser.Edu_Description1; cv.Edu_Description2 = appUser.Edu_Description2; cv.Edu_Description3 = appUser.Edu_Description3; cv.Edu_DateStart1 = appUser.Edu_DateStart1; cv.Edu_DateStart2 = appUser.Edu_DateStart2; cv.Edu_DateStart3 = appUser.Edu_DateStart3; cv.Edu_DateEnd1 = appUser.Edu_DateEnd1; cv.Edu_DateEnd2 = appUser.Edu_DateEnd2; cv.Edu_DateEnd3 = appUser.Edu_DateEnd3; cv.Skill1 = appUser.Skill1; cv.Skill2 = appUser.Skill2; cv.Skill3 = appUser.Skill3; cv.Hobbies_Desc = appUser.Hobbies_Desc; cv.Visibility = appUser.Visibility; cv.Success = appUser.Success; cv.CV_Category = appUser.CV_Category; return(View(cv)); }