Intial
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
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<ProfileForm>(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user