public ActionResult Index() { var userManager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new ApplicationDbContext())); ApplicationUser user = userManager.FindByNameAsync(User.Identity.Name).Result; model = new ImageModel(); if (user != null) { model.ImageUrl = user.ImageUrl; } return PartialView("~/Views/Shared/_LoginPartial.cshtml", model); }
public async Task<ActionResult> SetProfilePictureInLayout(ImageModel model, string returnUrl) { if (ModelState.IsValid) { ApplicationUser user = await UserManager.FindByIdAsync(User.Identity.GetUserId()); model.ImageUrl = user.ImageUrl; } return View(model); }