public JsonResult UpdateUserProfile(UserProfileModel model) { string message = "Failed to save Profile."; if (ModelState.IsValid) { string userId = User.Identity.GetUserId(); AccessLogger.Log(userId, "Update Profile"); bool result = model.Save(); if (result) { message = "Profile has been saved."; } } return Json(message, JsonRequestBehavior.AllowGet); }
public JsonResult GetUserProfile(string userId) { // Get Profile model by UserId & return to the View UserProfileModel model = new UserProfileModel().GetByUserId(userId); if (model != null) { ApplicationUser user = UserManager.FindById(userId); model.Email = user.Email; } return Json(model, JsonRequestBehavior.AllowGet); }
// // GET: /Account/Profile public ActionResult UserProfile(string userId) { ViewBag.UserId = String.Empty; if (userId != null) { // Get Profile model by UserId & return to the View UserProfileModel model = new UserProfileModel().GetByUserId(userId); if (model != null) { ViewBag.UserId = model.UserId; } return View(model); } return View(); }
public ActionResult UserProfile(UserProfileModel model, string returnUrl) { if (ModelState.IsValid) { string userId = User.Identity.GetUserId(); AccessLogger.Log(userId, "Update Profile"); bool result = model.Save(); if (result) { ViewBag.Message = "Profile has been saved."; } } return View(model); }
public JsonResult FindUser(string email) { List<string> roles = new List<string>(); UserProfileModel model = new UserProfileModel(); ApplicationUser user = UserManager.FindByEmail(email); if (user != null && user.Id != null) { // Get Profile model by UserId & return to the View model = new UserProfileModel().GetByUserId(user.Id); } return Json(model, JsonRequestBehavior.AllowGet); }