Exemplo n.º 1
0
        public async Task <IActionResult> PaidPerVendor(PaidPerVendor ppv)
        {
            try
            {
                using (HttpClient client = new HttpClient())
                {
                    string body = JsonConvert.SerializeObject(ppv);
                    HttpResponseMessage message = await client.PostAsync("https://localhost:44313/api/vendor/", new StringContent(body, Encoding.UTF8, "application/json"));

                    if (message.IsSuccessStatusCode)
                    {
                        var response = await message.Content.ReadAsStringAsync();

                        List <VendorPaymentDto> vendors = JsonConvert.DeserializeObject <List <VendorPaymentDto> >(response);
                        return(View("VendorAmount", vendors));
                    }
                    else
                    {
                    }
                }
                return(View());
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 2
0
 public async Task <List <VendorPaymentDto> > Post([FromBody] PaidPerVendor ppv)
 {
     return(await _transactionService.GetAmountPaidPerVendorInTime(ppv.From, ppv.To));
 }