Exemplo n.º 1
0
        public string InsertCart(InsertCartModel insertCartModel)
        {
            Task <string> insertCartTask = InsertCartAsync(insertCartModel);

            insertCartTask.Wait();

            return(insertCartTask.Result);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> InsertCart(InsertCartModel model)
        {
            model.CallbackUrl = $"{this.Request.Scheme}://{this.Request.Host}{this.Request.PathBase}{Url.Action(nameof(CallbackController.Callback), "Callback")}";

            INetgiroCart netgiroCart = new NetgiroCartRestSharpClient(_appSettings.ApiUrl, _appSettings.SecretKey, _appSettings.ApplicationId);

            try
            {
                string response = await netgiroCart.InsertCartAsync(model);

                return(Json(new { success = true, data = response }));
            }
            catch (Exception ex)
            {
                return(Json(new { success = false, data = ex.Message }));
            }
        }
Exemplo n.º 3
0
        public async Task <string> InsertCartAsync(InsertCartModel insertCartModel)
        {
            HttpRequestMessage httpRequestMessage = GenerateHttpRequestMessage(insertCartModel, Constants.Netgiro_Api_InsertCartURL, RandomString.Generate());

            return(await DoPost(httpRequestMessage));
        }
Exemplo n.º 4
0
        public Task <string> InsertCartAsync(InsertCartModel insertCartModel)
        {
            RestRequest restRequest = GenerateRestRequest(insertCartModel, Constants.Netgiro_Api_InsertCartURL, RandomString.Generate());

            return(ExecuteRequest(restRequest));
        }
Exemplo n.º 5
0
        public IActionResult Index()
        {
            var model = new InsertCartModel();

            return(View(model));
        }