Пример #1
0
        public ActionResult PlanRequest(string Plan, PlanType planType)
        {
            if (Plan == null)
            {
                return(new RedirectToError());
            }

            PlanRequestViewModel viewmodel = new PlanRequestViewModel();

            if (planType == PlanType.Company && !PlansPrices.CompanyPlans.ContainsKey(Plan))
            {
                return(new RedirectToError());
            }
            else if (planType == PlanType.Store && !PlansPrices.StorePlans.ContainsKey(Plan))
            {
                return(new RedirectToError());
            }
            else
            {
                viewmodel.plan = Plan;
                CountriesViewModel countries = new CountriesViewModel();
                viewmodel.country = countries.countries;

                return(View(viewmodel));
            }

            //var payTypes = from PayType e in Enum.GetValues(typeof(PayType))
            //               select new { Id = e, Name = Resource.EnumTypes.ResourceManager.GetString(e.ToString()) };
            //viewmodel.payTypeToSelectList = new SelectList(payTypes, "Id", "Name");
            ////PayBank SelectList
            //var payBanks = from PayBank e in Enum.GetValues(typeof(PayBank))
            //               select new { Id = e, Name = Resource.EnumTypes.ResourceManager.GetString(e.ToString()) };
            //viewmodel.bankTypeToSelectList = new SelectList(payBanks, "Id", "Name");
        }
Пример #2
0
        public ActionResult PlanRequest(PlanRequestViewModel planModel, string Plan, PlanType planType)
        {
            if (Plan == null)
            {
                return(new RedirectToError());
            }
            PaymentController planctlr = new PaymentController();

            if (ModelState.IsValid)
            {
                RequestForNew RequestToInsert = new RequestForNew();
                if (planType == PlanType.Company && PlansPrices.CompanyPlans.ContainsKey(Plan))
                {
                    RequestToInsert.planType = PlanType.Company;
                    RequestToInsert.plan     = planModel.plan;
                }
                else if (planType == PlanType.Store && PlansPrices.StorePlans.ContainsKey(Plan))
                {
                    RequestToInsert.planType = PlanType.Store;
                    RequestToInsert.plan     = planModel.plan;
                }
                else
                {
                    ModelState.AddModelError("", Resource.ControllerError.planQuery);
                    return(View(planModel));
                }
                RequestToInsert.requesterUserID = WebSecurity.CurrentUserId;
                RequestToInsert.name            = planModel.name;
                RequestToInsert.address         = planModel.address;
                RequestToInsert.about           = planModel.about;
                RequestToInsert.Email           = planModel.email;
                RequestToInsert.phoneNo         = planModel.phoneNo;
                RequestToInsert.regCode         = planModel.regCode;
                RequestToInsert.reqDate         = DateTime.UtcNow;
                RequestToInsert.stateID         = planModel.stateID;

                unitOfWork.NewPlanRequestRepository.Insert(RequestToInsert);
                unitOfWork.Save();
                UrlHelper Url = new UrlHelper(Request.RequestContext);
                return(Json(new { URL = Url.Action("PayForPlan", "Payment", new { reqId = EncryptionHelper.Protect(RequestToInsert.reqID) }) }));
            }
            else
            {
                throw new ModelStateException(this.ModelState);
            }
        }