Beispiel #1
0
        /// <summary>
        /// Public view of a badge, with associated work and experiences
        /// </summary>
        /// <param name="id">BadgeId</param>
        /// <returns></returns>
        public ActionResult Badge(Guid id)
        {
            var badgeSubmission = RepositoryFactory.BadgeSubmissionRepository.GetNullableById(id);

            if (badgeSubmission == null) return HttpNotFound();

            var model = new BadgeViewModel
                {
                    BadgeSubmission = badgeSubmission,
                    Badge = badgeSubmission.Badge,
                    Experiences = RepositoryFactory.BadgeFulfillmentRepository.Queryable.Where(x=>x.BadgeSubmission.Id == badgeSubmission.Id).Select(x=>x.Experience).ToList(),
                    Work = RepositoryFactory.BadgeFulfillmentRepository.Queryable.Where(x=>x.BadgeSubmission.Id == badgeSubmission.Id).Select(x=>x.SupportingWork).ToList(),
                    CreatorProfile = badgeSubmission.Creator.Profile
                };

            return View(model);
        }