using System.Web.Mvc; using AutoMapper; using InventoryTraker.Web.Identity; using InventoryTraker.Web.Models; using Microsoft.AspNet.Identity; namespace InventoryTraker.Web.Controllers { public class ProfileController : ControllerBase { private readonly ApplicationUserManager _userManager; public ProfileController(ApplicationUserManager userManager) { _userManager = userManager; } public ActionResult Index() { var user = _userManager.FindById(User.Identity.GetUserId()); var model = Mapper.Map(user); return View(model); } public JsonResult Update(ProfileForm form) { var user = _userManager.FindById(User.Identity.GetUserId()); user.Email = form.EmailAddress; user.UserName = form.FullName; _userManager.Update(user); return Json(true); } } }