ASP.NET Identity retrieving User's Email by UserId
<p>In my ASP.NET MVC application users can post projects and they will be store in the DB. As usual, there is an Index view for the projects where users can see the list of all the projects available, along with some action links beside them (Details/Apply).<br>
When a user clicks on the "Apply" action link, he is asked to fill in some words about why he wants to participate (cover letter). After he submits, an Application is stored inside the database containing a unique <code>ApplicationId</code>, the user's <code>UserId</code> and the <code>ProjectId</code> that he is applying to so I can keep track of all the applications.</p>

<pre><code>public class Application
{
    public int ApplicationId { get; set; }
    public int ProjectId { get; set; }
    public string UserId { get; set; }
    public string CoverLetter { get; set; }
}
</code></pre>

<p>In the "Details" view, all the project's data is being displayed, and managed to get it to display all the cover letters and the userId's that applied for this project.</p>

<pre><code>Cover letters:
@foreach (var item in Model.Applications)
{
    &lt;tr&gt;
        &lt;td&gt;
            &lt;br/&gt;
            @Html.DisplayFor(modelItem =&gt; item.CoverLetter) |
            @Html.DisplayFor(modelItem =&gt; item.UserId) |
        &lt;/td&gt;
    &lt;/tr&gt;
}
</code></pre>

<p>The <code>UserId</code> and <code>CoverLetter</code> from the Application is retrieved successfully, however what I need is based on the <code>UserId</code> to retrieve the user's name and email from the database. </p>

<p>Edit: here is the entire ProjectsController:</p>

<pre><code>   using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Web.Mvc;
using System.Web.Security;
using Leepio.Models;
using Microsoft.ApplicationInsights.Web;
using Microsoft.AspNet.Identity;

namespace Leepio.Controllers
{
    public class ProjectsController : Controller
    {
        private ApplicationDbContext db = new ApplicationDbContext();

        // GET: Projects
        [Authorize(Roles = "companyRole, studentRole")]
        public ActionResult Index(string SortOrder, string SortBy, string Page)
        {
            ViewBag.SortOrder = SortOrder;
            ViewBag.SortBy = SortBy;
            var projects = db.Projects.ToList();




            var model = new ApplicationTwoViewModel
            {
                Model1 = new List&lt;Project&gt;(projects),
                Model2 = new Application
                {

                    UserId = User.Identity.GetUserId(),
                    ProjectId = 11,
                    CoverLetter = "asdf",
                    ApplicationId = 23,
                }
            };

            switch (SortBy)
            {
                case "Title":
                 switch (SortOrder)
                    {
                        case "Asc":
                            projects = projects.OrderBy(x =&gt; x.Title).ToList();
                            break;
                        case "Desc":
                            projects = projects.OrderByDescending(x =&gt; x.Title).ToList();
                            break;
                        default:
                            break;
                    }
                    break;

                case "ApplicationDeadline":
                    switch (SortOrder)
                    {
                        case "Asc":
                            projects = projects.OrderBy(x =&gt; x.ApplicationDeadline).ToList();
                            break;
                        case "Desc":
                            projects = projects.OrderByDescending(x =&gt; x.ApplicationDeadline).ToList();
                            break;
                        default:
                            break;
                    }
                    break;

                case "Duration":
                    switch (SortOrder)
                    {
                        case "Asc":
                            projects = projects.OrderBy(x =&gt; x.Duration).ToList();
                            break;
                        case "Desc":
                            projects = projects.OrderByDescending(x =&gt; x.Duration).ToList();
                            break;
                        default:
                            break;
                    }
                    break;
                case "HourlyRate":
                    switch (SortOrder)
                    {
                        case "Asc":
                            projects = projects.OrderBy(x =&gt; x.HourlyRate).ToList();
                            break;
                        case "Desc":
                            projects = projects.OrderByDescending(x =&gt; x.HourlyRate).ToList();
                            break;
                        default:
                            break;
                    }
                    break;
                case "TotalProjectCost":
                    switch (SortOrder)
                    {
                        case "Asc":
                            projects = projects.OrderBy(x =&gt; x.TotalProjectCost).ToList();
                            break;
                        case "Desc":
                            projects = projects.OrderByDescending(x =&gt; x.TotalProjectCost).ToList();
                            break;
                        default:
                            break;
                    }
                    break;
                case "City":
                    switch (SortOrder)
                    {
                        case "Asc":
                            projects = projects.OrderBy(x =&gt; x.City).ToList();
                            break;
                        case "Desc":
                            projects = projects.OrderByDescending(x =&gt; x.City).ToList();
                            break;
                        default:
                            break;
                    }
                    break;
                case "RequiredPresencePercent":
                    switch (SortOrder)
                    {
                        case "Asc":
                            projects = projects.OrderBy(x =&gt; x.RequiredPresencePercent).ToList();
                            break;
                        case "Desc":
                            projects = projects.OrderByDescending(x =&gt; x.RequiredPresencePercent).ToList();
                            break;
                        default:
                            break;
                    }
                    break;
                case "Language":
                    switch (SortOrder)
                    {
                        case "Asc":
                            projects = projects.OrderBy(x =&gt; x.Language).ToList();
                            break;
                        case "Desc":
                            projects = projects.OrderByDescending(x =&gt; x.Language).ToList();
                            break;
                        default:
                            break;
                    }
                    break;
                case "RequiredSkills":
                    switch (SortOrder)
                    {
                        case "Asc":
                            projects = projects.OrderBy(x =&gt; x.RequiredSkills).ToList();
                            break;
                        case "Desc":
                            projects = projects.OrderByDescending(x =&gt; x.RequiredSkills).ToList();
                            break;
                        default:
                            break;
                    }
                    break;
                default:
                    projects = projects.OrderBy(x =&gt; x.Title).ToList();
                    break;
            }



            ViewBag.TotalPages = Math.Ceiling(db.Projects.ToList().Count()/10.0);
            int page = int.Parse(Page == null ? "1" : Page);
            ViewBag.Page = page;
            model.Model1 = projects;    
            model.Model1 = model.Model1.Skip((page - 1) * 10).Take(10).ToList();
            return View(model);

        }



        private UserManager&lt;IUser&lt;&gt;  userManager;


        // GET: Projects/Details/5
        [Authorize(Roles = "companyRole, studentRole")]
        public ActionResult Details(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }

            Project project = db.Projects.Find(id);

            if (project == null)
            {
                return HttpNotFound();
            }
            return View(project);
        }

        // GET: Projects/Create
        [Authorize(Roles= "companyRole")]
        public ActionResult Create()
        {
            return View();
        }

        // POST: Projects/Create
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        [Authorize(Roles = "companyRole")]
        public ActionResult Create([Bind(Include = "UserId,ProjectId,Title,ApplicationDeadline,Duration,HourlyRate,TotalProjectCost,City,RequiredPresencePercent,Language,RequiredSkills,Description")] Project project)
        {
            if (ModelState.IsValid)
            {
                project.UserId = User.Identity.GetUserId();
                db.Projects.Add(project);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(project);
        }

        // GET: Projectts/Edit/5
        [Authorize(Roles = "companyRole")]
        public ActionResult Edit(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            Project project = db.Projects.Find(id);
            if (project == null)
            {
                return HttpNotFound();
            }
            return View(project);
        }

        // POST: Projects/Edit/5
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        [Authorize(Roles = "companyRole")]
        public ActionResult Edit([Bind(Include = "ProjectId,UserId,Title,ApplicationDeadline,Duration,HourlyRate,TotalProjectCost,City,RequiredPresencePercent,Language,RequiredSkills,Description")] Project project)
        {
            if (ModelState.IsValid)
            {

                if (project.UserId == User.Identity.GetUserId())
                { 
                db.Entry(project).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
                }

                return HttpNotFound("Project is not yours!");

            }
            return View(project);
        }

        // GET: Projects/Delete/5
        [Authorize(Roles = "companyRole")]
        public ActionResult Delete(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            Project project = db.Projects.Find(id);
            if (project == null)
            {
                return HttpNotFound();
            }
            return View(project);
        }

        // POST: Projects/Delete/5
        [HttpPost, ActionName("Delete")]
        [ValidateAntiForgeryToken]
        [Authorize(Roles = "companyRole")]
        public ActionResult DeleteConfirmed(int id)
        {
            Project project = db.Projects.Find(id);
            if (project.UserId == User.Identity.GetUserId())
            {
                db.Projects.Remove(project);
                db.SaveChanges();
            }
            else
            {
                return HttpNotFound("Project is not yours!");
            }


            return RedirectToAction("Index");
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                db.Dispose();
            }
            base.Dispose(disposing);
        }
    }
}
</code></pre>

<p>Do I actually need to change anything inside the <code>ApplicationController</code>? I am not sure how to go about doing this.</p>