public ActionResult Profile(int id)
{
// load up the person
var person = Repository.OfType<Person>().GetNullableById(id);
if (person != null)
{
// get the last registration
var seminarPerson = person.GetLatestRegistration(Site);
var site = SiteService.LoadSite(Site);
if (site.BackgroundPerson.Id == id)
{
ViewBag.Title = "Profile";
return View(seminarPerson);
}
// is this person in the public roles of either faculty directory or steering committee?
var roles = seminarPerson.SeminarRoles.Select(a => a.Id);
if (roles.Contains(StaticIndexes.Role_FacultyDirector))
{
ViewBag.Title = "Academic Director";
return View(seminarPerson);
}
if (roles.Contains(StaticIndexes.Role_SteeringCommittee))
{
ViewBag.Title = "Steering Committee Member";
return View(seminarPerson);
}
}
// unkown error, but really, trying to access profile that should not be public
return this.RedirectToAction<ErrorController>(a => a.Index());
}