コード例 #1
0
ファイル: HomeController.cs プロジェクト: queoGmbH/peanuts
        public async Task <ActionResult> Index(User currentUser)
        {
            IPage <UserGroupMembership> memberships = UserGroupService.FindMembershipsByUser(PageRequest.All, currentUser, new List <UserGroupMembershipType> {
                UserGroupMembershipType.Administrator, UserGroupMembershipType.Member
            });
            IPage <Payment>             pendingPayments      = PaymentService.FindPendingPaymentsByUser(PageRequest.First, currentUser);
            IPage <Payment>             declinedPayments     = PaymentService.FindDeclinedPaymentsByUser(PageRequest.First, currentUser);
            IPage <PeanutParticipation> peanutParticipations = PeanutService.FindParticipationsOfUser(PageRequest.All, currentUser, DateTime.Today, DateTime.Today);

            IPage <Bill> declinedBills  = BillService.FindDeclinedCreditorBillsByUser(PageRequest.All, currentUser);
            List <Bill>  unsettledBills =
                BillService.FindCreditorBillsForUser(PageRequest.All, currentUser, false).ToList();

            unsettledBills.AddRange(BillService.FindDebitorBillsForUser(PageRequest.All, currentUser, false).ToList());
            return(View("Index", new IndexViewModel(peanutParticipations, memberships, unsettledBills, declinedBills, pendingPayments, declinedPayments, currentUser.DisplayName)));
        }
コード例 #2
0
        public ActionResult AllMemberships(User currentUser)
        {
            IList <UserGroupMembership> currentMemberships =
                UserGroupService.FindMembershipsByUser(PageRequest.All,
                                                       currentUser,
                                                       new List <UserGroupMembershipType> {
                UserGroupMembershipType.Administrator, UserGroupMembershipType.Member
            }).ToList();
            IList <UserGroupMembership> myRequestedMemberships =
                UserGroupService.FindMembershipsByUser(PageRequest.All,
                                                       currentUser,
                                                       new List <UserGroupMembershipType> {
                UserGroupMembershipType.Request
            }).ToList();
            IList <UserGroupMembership> invitations =
                UserGroupService.FindMembershipsByUser(PageRequest.All,
                                                       currentUser,
                                                       new List <UserGroupMembershipType> {
                UserGroupMembershipType.Invited
            }).ToList();

            IList <UserGroupMembership> myGroups =
                UserGroupService.FindMembershipsByUser(PageRequest.All,
                                                       currentUser,
                                                       new List <UserGroupMembershipType> {
                UserGroupMembershipType.Administrator
            }).ToList();
            IList <UserGroupMembership> requestedMembershipsInMyGroup =
                UserGroupService.FindMembershipsByGroups(PageRequest.All,
                                                         myGroups.Select(mem => mem.UserGroup).ToList(),
                                                         new List <UserGroupMembershipType> {
                UserGroupMembershipType.Request
            }).ToList();

            return(View(new UserGroupIndexViewModel(currentMemberships, myRequestedMemberships, invitations, requestedMembershipsInMyGroup)));
        }