//public ActionResult Details() //{ // return RedirectToAction("Error", "Home"); //} // GET: Projects/Details/5 public ActionResult Details(int?id) { var project = _projectService.GetProjectById(id ?? 0); var donations = _donationService.GetAllDonationsByProjectId(id ?? 0).ToList(); var projectMedia = _projectService.GetProjectMediaByProjectId(id ?? 0).ToList(); var comments = _projectService.GetCommentsByProjectId(id ?? 0).ToList(); var rewards = _rewardService.GetAllRewardsByProjectId(id ?? 0).ToList(); var projectVM = new ProjectViewModel(); if (GetUserId() != null) { ViewBag.Flag = true; ViewBag.MemberId = _memberService.GetMemberById(GetUserId()).MemberId; } else { ViewBag.Flag = false; } projectVM = Mapper.Map <ProjectViewModel>(project); if (donations != null) { var don = Mapper.Map <List <DonationViewModel> >(donations); projectVM.Donations = don; } if (projectMedia != null) { var pm = Mapper.Map <List <ProjectMediaViewModel> >(projectMedia); projectVM.ProjectMedia = pm; } if (comments != null) { var comm = Mapper.Map <List <CommentViewModel> >(comments); projectVM.Comments = comm; } if (rewards != null) { var rwd = Mapper.Map <List <RewardViewModel> >(rewards); projectVM.Rewards = rwd; } if (project != null) { project.Views++; _projectService.SetProject(project); return(View(projectVM)); } return(RedirectToAction("Error", "Home")); }
public IEnumerable<Reward> GetRewardByProjectId(int id) { var rewards = _rewardService.GetAllRewardsByProjectId(id); return rewards; }