// GET: EnterPaymentAmount
        public ActionResult Index(int customer_id, string customerName, long cardNumber, int token_id, string token)
        {
            TokenAndCutomerDetails data = new TokenAndCutomerDetails
            {
                Customer_Id   = customer_id,
                Customer_Name = customerName,
                Card_Number   = cardNumber,
                Token_Id      = token_id,
                Token         = token
            };

            return(View(data));
        }
Пример #2
0
        public ActionResult create(Customer customer)
        {
            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri("http://localhost:4074/api/CustomerDetails");

                //HTTP POST
                var postTask = client.PostAsJsonAsync <Customer>("http://localhost:4074/api/CustomerDetails/EnterCustomerData", customer);
                postTask.Wait();

                var readTask = postTask.Result.Content.ReadAsStringAsync();
                readTask.Wait();


                string ResponseValue = readTask.Result;

                var    data         = (JObject)JsonConvert.DeserializeObject(ResponseValue);
                string token        = data["token"].Value <string>();
                int    customerId   = data["customerId"].Value <int>();
                string customerName = data["name"].Value <string>();
                string emailId      = data["emailId"].Value <string>();
                long   cardNumber   = data["cardNumber"].Value <long>();
                int    tokenId      = data["token_id"].Value <int>();

                TokenAndCutomerDetails tokenAndCustomer = new TokenAndCutomerDetails();
                tokenAndCustomer.Customer_Id    = customerId;
                tokenAndCustomer.Customer_Name  = customerName;
                tokenAndCustomer.Customer_Email = emailId;
                tokenAndCustomer.Card_Number    = cardNumber;
                tokenAndCustomer.Token          = token;
                tokenAndCustomer.Token_Id       = tokenId;


                var result = postTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    return(RedirectToAction("ShowToken", "GetToken", tokenAndCustomer));
                }
                // Pointers
                //else
            }

            ModelState.AddModelError(string.Empty, "Server Error. Please contact administrator.");

            return(View(customer));
        }
Пример #3
0
 public ActionResult ShowToken(TokenAndCutomerDetails details)
 {
     return(View(details));
 }