using System; using System.Collections.Generic; using System.Linq; using System.Security.Claims; using System.Threading.Tasks; using System.Web; using System.Web.Http; using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity.EntityFramework; using Microsoft.AspNet.Identity.Owin; using Microsoft.Owin.Security; using Owin; using Winsoft.GOV.XF.WX.Models; namespace Winsoft.GOV.XF.WX.Controllers { [Authorize] public class MeController : ApiController { private ApplicationUserManager _userManager; public MeController() { } public MeController(ApplicationUserManager userManager) { UserManager = userManager; } public ApplicationUserManager UserManager { get { return _userManager ?? HttpContext.Current.GetOwinContext().GetUserManager(); } private set { _userManager = value; } } // GET api/Me public GetViewModel Get() { var user = UserManager.FindById(User.Identity.GetUserId()); return new GetViewModel() { Hometown = user.Hometown }; } } }