コード例 #1
0
 public static async Task <SignupModel> GetSignupModel(this MemberContext db, Guid id)
 => await db.Events
 .Include(e => e.SignupOptions)
 .Include(e => e.Questions)
 .ThenInclude(q => q.Options)
 .AsNoTracking()
 .Expressionify()
 .Where(e => e.Archived == false)
 .Select(e => SignupModel.Create(e))
 .SingleOrDefaultAsync(e => e.Id == id);
コード例 #2
0
        private async Task <string> CreatePayment(SignupModel model, decimal amount)
        {
            var sessionId = await _paymentService.CreatePayment(
                model.User.FullName,
                model.User.Email,
                model.Title,
                model.Description,
                amount,
                SignupSuccessLink(model.Id),
                Request.GetDisplayUrl(),
                eventSignupId : model.UserEventSignup.Id);

            return(sessionId);
        }
コード例 #3
0
        private async Task <AcceptModel> CreateAcceptModel(SignupModel model)
        {
            var mustPayClassesFee    = model.User.MustPayClassesFee(model.Options);
            var mustPayTrainingFee   = model.User.MustPayTrainingFee(model.Options);
            var mustPayMembershipFee = model.User.MustPayMembershipFee(model.Options);

            var mustPayMembersPrice    = model.User.MustPayMembersPrice(model.Options);
            var mustPayNonMembersPrice = model.User.MustPayNonMembersPrice(model.Options);

            var acceptModel = new AcceptModel
            {
                Id                   = model.Id,
                Title                = model.Title,
                Description          = model.Description,
                MustPayClassesFee    = mustPayClassesFee,
                MustPayTrainingFee   = mustPayTrainingFee,
                MustPayMembershipFee = mustPayMembershipFee
            };

            if (mustPayClassesFee)
            {
                var classesFee = model.User.GetClassesFee().Fee;
                acceptModel.MustPayAmount = classesFee.Amount;
                acceptModel.SessionId     = await CreatePayment(model, classesFee, model.UserEventSignup.Id);
            }
            else if (mustPayTrainingFee)
            {
                var trainingFee = model.User.GetTrainingFee().Fee;
                acceptModel.MustPayAmount = trainingFee.Amount;
                acceptModel.SessionId     = await CreatePayment(model, trainingFee, model.UserEventSignup.Id);
            }
            else if (mustPayMembershipFee)
            {
                var membershipFee = model.User.GetMembershipFee().Fee;
                acceptModel.MustPayAmount = membershipFee.Amount;
                acceptModel.SessionId     = await CreatePayment(model, membershipFee, model.UserEventSignup.Id);
            }
            else if (mustPayMembersPrice)
            {
                acceptModel.MustPayAmount = model.Options.PriceForMembers;
                acceptModel.SessionId     = await CreatePayment(model, model.Options.PriceForMembers);
            }
            else if (mustPayNonMembersPrice)
            {
                acceptModel.MustPayAmount = model.Options.PriceForNonMembers;
                acceptModel.SessionId     = await CreatePayment(model, model.Options.PriceForNonMembers);
            }

            return(acceptModel);
        }
コード例 #4
0
        private async Task <string> CreatePayment(SignupModel model, Fee fee, Guid eventSignupId)
        {
            var sessionId = await _paymentService.CreatePayment(
                model.User.FullName,
                model.User.Email,
                fee.Description,
                fee.Description,
                fee.Amount,
                SignupSuccessLink(model.Id),
                Request.GetDisplayUrl(),
                fee.IncludesMembership,
                fee.IncludesTraining,
                fee.IncludesClasses,
                eventSignupId : eventSignupId);

            return(sessionId);
        }