public ActionResult Edit() { var EmployeeId = User.Identity.GetUserId(); var Employee1 = db.Employees.SingleOrDefault(x => x.Id == EmployeeId); EditEmployeeProfileViewModel Profile = new EditEmployeeProfileViewModel(); Profile.Email = Employee1.Email; Profile.FirstName = Employee1.FirstName; //Profile.LastName = student1.LastName; return View(Profile); }
public ActionResult Edit(EditEmployeeProfileViewModel Profile) { var EmployeeId = User.Identity.GetUserId(); var Employee1 = db.Employees.SingleOrDefault(x => x.Id == EmployeeId); Employee1.Email = Profile.Email; Employee1.FirstName = Profile.FirstName; Employee1.LastName = Profile.LastName; Employee1.City = Profile.City; db.Entry(Employee1).State = EntityState.Modified; db.SaveChanges(); return View(Profile); }