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);
}