Badges.Controllers.InstructorController.ViewExperience C# (CSharp) Method

ViewExperience() public method

View an experience as an instructor NOTE: Instructor must have acccess to the experience AND the experience must have instructorViewable = true
public ViewExperience ( System.Guid id, System.Guid notificationId ) : System.Web.Mvc.ActionResult
id System.Guid Experience Id
notificationId System.Guid Notification to show along with experience
return System.Web.Mvc.ActionResult
        public ActionResult ViewExperience(Guid id, Guid? notificationId)
        {
            var experience =
                RepositoryFactory.ExperienceRepository.Queryable.SingleOrDefault(x => x.Id == id &&
                                                                                      x.Instructors.Any(i => i.Identifier == CurrentUser.Identity.Name));

            if (experience == null)
            {
                return new HttpNotFoundResult();
            }
            if (experience.InstructorViewable == false)
            {
                return new HttpUnauthorizedResult();
            }

            var notification = notificationId.HasValue == false
                                   ? null
                                   : RepositoryFactory.FeedbackRequestRepository.Queryable.SingleOrDefault(
                                       x =>
                                       x.Id == notificationId.Value &&
                                       x.Instructor.Identifier == CurrentUser.Identity.Name);

            var model = new ExperienceViewModel
                {
                    Experience = experience,
                    Notification = notification,
                    SupportingWorks = experience.SupportingWorks.ToList(),
                    ExperienceOutcomes = experience.ExperienceOutcomes.ToList()
                };

            return View(model);
        }