Example #1
0
        public ActionResult <BaseViewModel <PaymentMethodViewModel> > PostPaymentMethod(CreatePaymentMethodRequestViewModel location)
        {
            var result = _locationService.CreatePaymentMethod(location);

            this.HttpContext.Response.StatusCode = (int)result.StatusCode;

            return(result);
        }
        public async Task <Unit> Handle(AddPaymentMethodCommand request, CancellationToken cancellationToken)
        {
            var customer = await _unitOfWork.CustomerRepository.GetCustomerWithPaymentMethods(request.Id);

            Fail.IfNull(customer, request.Id);

            var paymentMethod = _paymentMethodService.CreatePaymentMethod(request.Type, request.Email, request.Password,
                                                                          request.PhoneNumber, request.IsAlwaysLoggedIn, request.CardNumber, request.ExpiryDate, request.CvvCode, request.Country);

            customer.AddPaymentMethod(paymentMethod);
            await _unitOfWork.CommitAsync();

            return(Unit.Value);
        }
Example #3
0
        public virtual async Task <ActionResult> Create(PaymentMethodCreateViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            model.CreatorID = await GetCurrentUserIdAsync();

            _paymentMethodService.CreatePaymentMethod(model);

            if (string.IsNullOrEmpty(model.PreviousUrl))
            {
                return(RedirectToAction(MVC.Home.ActionNames.Index, MVC.Home.Name));
            }
            return(Redirect(model.PreviousUrl));
        }