コード例 #1
0
        // GET: PrayerRequestViewModels/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var prayerRequest = unitOfWork.ContactRecordRepository.FindById(id);

            if (prayerRequest == null)
            {
                return(HttpNotFound());
            }

            // Get principal user
            var user = unitOfWork.AppUserRepository.FindUserByEmail(User.Identity.Name);

            var prayerRequestVM = Mapper.Map <PrayerRequestViewModel>(prayerRequest);

            // Keep comments private for other users if marked as such
            _service.KeepCommentsPrivate(prayerRequestVM, user.Id);

            return(View(prayerRequestVM));
        }