Agribusiness.Web.Controllers.PublicController.Profile C# (CSharp) Метод

Profile() публичный Метод

Display a short bio and picture of the current Academic Director for the seminar
public Profile ( int id ) : System.Web.Mvc.ActionResult
id int Id of the person we want to display
Результат System.Web.Mvc.ActionResult
        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());
        }