public ActionResult EditPreferences(PartnerPreferencesDTO preferences)
 {
     if (ModelState.IsValid)
     {
         PartnerBLL partnerBLL = new PartnerBLL(WebApp.Connector);
         partnerBLL.UpdatePreferences(Account.Id, preferences);
         TempData["Result"] = "PreferencesHaveBeenUpdated";
         return(RedirectToAction("MyProfile"));
     }
     else
     {
         EditPreferences_Base();
         return(BadRequestWithErrors(preferences));
     }
 }
示例#2
0
        public ActionResult SignupStep4(PartnerPreferencesDTO preferences)
        {
            if (ModelState.IsValid)
            {
                PartnerBLL partnerBLL = new PartnerBLL(WebApp.Connector)
                {
                    EmailAddressVerificationSubject  = LocalizationProvider["VerifyYourEmailAddress"],
                    EmailAddressVerificationTemplate = LocalizationProvider["EmailVerificationTemplate"]
                };
                PartnerDTO             partner      = new PartnerDTO();
                PartnerCredentialDTO   credential   = Session["Signup$Credential"] as PartnerCredentialDTO;
                PartnerPersonalInfoDTO personalInfo = Session["Signup$PersonalInfo"] as PartnerPersonalInfoDTO;
                PartnerCompanyInfoDTO  companyInfo  = Session["Signup$CompanyInfo"] as PartnerCompanyInfoDTO;
                partner.Join(credential);
                partner.Join(personalInfo);
                partner.Join(companyInfo);
                partner.Join(preferences);
                Uri    requestUrl = Request.Url;
                string baseUrl    = new UriBuilder(requestUrl.Scheme, requestUrl.Host, requestUrl.Port).ToString();
                PartnerBLL.SignupResult result = partnerBLL.Signup(partner, baseUrl, Url.Action("VerifyEmailAddress"));
                switch (result)
                {
                case PartnerBLL.SignupResult.OK:
                    Session["Signup$Preferences"] = preferences;
                    return(RedirectToAction("VerifyEmailAddress"));

                case PartnerBLL.SignupResult.UsernameAlreadyUsed:
                    TempData["Errors"] = new Dictionary <string, string>()
                    {
                        { "Username", result.ToString() }
                    };
                    return(RedirectToAction("SignupStep1"));

                case PartnerBLL.SignupResult.EmailAddressAlreadyUsed:
                    TempData["Errors"] = new Dictionary <string, string>()
                    {
                        { "EmailAddress", result.ToString() }
                    };
                    return(RedirectToAction("SignupStep2"));

                default: return(BadRequest());
                }
            }
            else
            {
                return(BadRequestWithErrors(preferences));
            }
        }
示例#3
0
 public ActionResult SignupStep4()
 {
     if (Session["Signup$CompanyInfo"] is PartnerCompanyInfoDTO companyInfo)
     {
         CountryBLL            countryBLL  = new CountryBLL(WebApp.Connector);
         PartnerPreferencesDTO preferences = Session["Signup$Preferences"] as PartnerPreferencesDTO;
         CountryDTO            country     = countryBLL.ReadById(companyInfo.Country.Id);
         ViewBag.Currencies = country.SupportedCurrencies;
         ViewBag.Languages  = country.SupportedLanguages;
         return(View(preferences));
     }
     else
     {
         return(RedirectToAction("SignupStep3"));
     }
 }