private static ProfileEditViewModel LoadProfileEditViewModel(User u) { var vm = new ProfileEditViewModel { OldUsername = u.Username, OldEmailAddress = u.EmailAddress }; return vm; }
public ActionResult GetProfileData() { var vm = new ProfileEditViewModel(); if (System.Web.HttpContext.Current.User.Identity.Name != null) { string username = System.Web.HttpContext.Current.User.Identity.Name; if (username.Length > 0) { User u = _accountServices.GetUserByUsername(username); if (u != null) vm = LoadProfileEditViewModel(u); } } return Json(vm, JsonRequestBehavior.AllowGet); }