コード例 #1
0
        public ActionResult SignUpPayAndGo(PayAndGoRegistration payNoGoRegistration)
        {
            _logger.Info("Entered Sign Up Page!");

            if (!ModelState.IsValid)
            {
                return(View("SignUpPayAndGo", payNoGoRegistration));
            }

            var             resourceURI = @"Registration/RegisterIndividual";
            UserReturnModel createdUser = null;


            _logger.Info(payNoGoRegistration.AgreeToPayandGoConditions);

            if (!payNoGoRegistration.AgreeToPayandGoConditions)
            {
                ModelState.AddModelError("AgreeToPayandGoConditions", "In order to use the pay and go service you must click the agreement checkbox");
                return(View("SignUpPayAndGo", payNoGoRegistration));
            }

            try
            {
                createdUser = this.SendPostRequest <IndividualRegistration, UserReturnModel>(resourceURI, payNoGoRegistration);

                PrepareAndSendConfirmationEmail(createdUser.Email, createdUser.Id, createdUser.UserName);

                TempData["IsEmailSentSuccessfully"] = true;

                _logger.Debug("PayAndGoAttemptedHere");

                #region Pay and Go Specific Stuff

                var resourceURI2 = @"Registration/PayAndGoIndividual";

                var payAndGoResult = this.SendPostRequest <PayAndGoRegistration, string>(resourceURI2, payNoGoRegistration);

                #endregion Pay and Go Specific Stuff

                return(RedirectToAction("SignUpComplete", "SignUp", new RouteValueDictionary(createdUser)));
            }
            catch (ApiException ex)
            {
                return(View("SignUpIndividual", payNoGoRegistration));
            }
            catch (EmailException emailException)
            {
                TempData["IsEmailSentSuccessfully"] = false;

                return(RedirectToAction("SignUpComplete", "SignUp", new RouteValueDictionary(createdUser)));
            }
        }
コード例 #2
0
        public IHttpActionResult PayAndGoIndividual(PayAndGoRegistration payAndGoRegistration)
        {
            //save to database here the new images
            //save to the database


            //send email to customer service here
            var result = _utilityManager.SendEmailToUser("*****@*****.**", "Pay and Go Sign Up", string.Format("The following user has signed up for Pay and Go: <br/><br/>" +
                                                                                                                             "First Name : {0}<br/> LastName : {1}<br/> TRN : {2}<br/>Address : {3}<br/>Email Address : {4} <br/>UserName : {5}<br/>Password : {6}<br/>Mobile Number : {7}<br/>",
                                                                                                                             payAndGoRegistration.PrimaryUser.FirstName, payAndGoRegistration.PrimaryUser.LastName, payAndGoRegistration.TRN, payAndGoRegistration.Address,
                                                                                                                             payAndGoRegistration.PrimaryUser.Email, payAndGoRegistration.PrimaryUser.Username, payAndGoRegistration.PrimaryUser.Password, payAndGoRegistration.PrimaryUser.MobileNumber)

                                                         );

            if (result.IsSuccess)
            {
                _logger.Debug("test email sent");
                return(Ok("Pay and Go Notification Sent"));
            }
            else
            {
                return(GetErrorResult(result));
            }
        }