示例#1
0
        public ActionResult ViewContributions()
        {
            ActionResult view = View("Error");

            int userId = RetrieveUserId();

            IEnumerable <NeedContribution> collection = new UserNeedsManager(userId).RetrieveAllContributions();

            if (null != collection)
            {
                ContributionsDetailViewModel model = new ContributionsDetailViewModel();

                model.PendingContributions
                    = collection.Where(n => !n.Contributed.HasValue);
                collection
                    = collection.Where(n => n.Contributed.HasValue);
                model.ApprovedContributions
                    = collection.Where(n => n.Contributed.Value);
                model.DeclinedContributions
                    = collection.Where(n => !n.Contributed.Value);

                view = View(model);
            }

            return(view);
        }
示例#2
0
        public ActionResult Index()
        {
            ActionResult view = View("Error");

            IEnumerable <GroupNeedSummary> summary = UserNeedsManager.RetrieveGroupsOfNeed();

            if (null != summary)
            {
                view = View(summary);
            }

            return(view);
        }
示例#3
0
        public ActionResult SendContribution(int?id)
        {
            ActionResult view = View("Error");

            if (id.HasValue)
            {
                SendContributionViewModel model = new SendContributionViewModel();

                GardenNeed need = UserNeedsManager.RetrieveNeed(id.Value);

                model.NeedTitle
                    = need.Title;
                model.NeedID
                    = need.GardenNeedId;

                view = View(model);
            }

            return(view);
        }
示例#4
0
        public ActionResult ViewGroupNeeds(int?id)
        {
            ActionResult view = View("Error");

            if (id.HasValue)
            {
                GroupNeedsDetailViewModel model = new GroupNeedsDetailViewModel();

                model.GardenSummaries = UserNeedsManager.RetrieveGroupGardensOfNeed(id.Value);

                if (null != model.GardenSummaries)
                {
                    model.ActiveNeeds = GardenNeedsManager.RetrieveGroupNeeds(id.Value);
                }

                if (null != model.ActiveNeeds || null != model.GardenSummaries)
                {
                    view = View(model);
                }
            }

            return(view);
        }
 public void TestSetup()
 {
     userNeedsManager = new UserNeedsManager();
 }