Пример #1
0
        private void AssertAllocation(int?credits)
        {
            // Check the allocation.

            var allocation = _allocationsQuery.GetAllocation(_allocation.Id);

            if (credits == null)
            {
                Assert.IsNull(allocation.InitialQuantity);
                Assert.IsNull(allocation.RemainingQuantity);
            }
            else
            {
                Assert.AreEqual(credits.Value, allocation.InitialQuantity);
                Assert.AreEqual(credits.Value - 1, allocation.RemainingQuantity);
            }
        }
Пример #2
0
        public ActionResult AllocationUsage(Guid id, Guid allocationId)
        {
            var organisation = _organisationsQuery.GetOrganisation(id);

            if (organisation == null)
            {
                return(NotFound("organisation", "id", id));
            }

            var allocation = _allocationsQuery.GetAllocation(allocationId);

            if (allocation == null)
            {
                return(NotFound("allocation", "id", allocationId));
            }

            // Get credits exercised for this allocation.

            var exercisedCredits = _exercisedCreditsQuery.GetExercisedCredits(allocationId);

            // Get all associated data.

            var credit = _creditsQuery.GetCredit(allocation.CreditId);

            return(View(new OrganisationAllocationExercisedCreditsModel
            {
                Organisation = organisation,
                ExercisedCredits = exercisedCredits,
                Allocations = new Dictionary <Guid, Allocation> {
                    { allocation.Id, allocation }
                },
                Credits = new Dictionary <Guid, Credit> {
                    { credit.Id, credit }
                },
                JobAds = _jobAdsQuery.GetJobAds(exercisedCredits),
                Members = _membersQuery.GetMembers(exercisedCredits),
                Employers = _employersQuery.GetEmployers(exercisedCredits),
            }));
        }