Пример #1
0
        public async Task <IActionResult> GetRevenueByMonthReport([FromQuery] GetRevenueRequest request)
        {
            var result = await _reportService.GetReportByMonthAsync(request.fromDate, request.toDate);

            if (result.IsSuccess)
            {
                return(Ok(result));
            }
            else
            {
                return(BadRequest(result));
            }
        }
Пример #2
0
        public async Task <ApiResult <List <RevenueByMonthReportViewModel> > > GetRevenueByMonthReport(GetRevenueRequest request)
        {
            var client = _httpClientFactory.CreateClient();

            client.BaseAddress = new Uri(_configuration["BaseAddress"]);

            var json        = JsonConvert.SerializeObject(request);
            var httpContent = new StringContent(json, Encoding.UTF8, "application/json");

            var respone = await client.GetAsync($"/api/report/RevenueByMonth?FromDate={request.fromDate}&ToDate={request.toDate}");

            var result = await respone.Content.ReadAsStringAsync();

            if (respone.IsSuccessStatusCode)
            {
                return(JsonConvert.DeserializeObject <ApiSuccessResult <List <RevenueByMonthReportViewModel> > >(result));
            }
            else
            {
                return(JsonConvert.DeserializeObject <ApiErrorResult <List <RevenueByMonthReportViewModel> > >(result));
            }
        }