Готовый отчёт для клиента.
This commit is contained in:
parent
a46290e4d4
commit
79cc787ebf
@ -50,5 +50,25 @@ namespace BankYouBankruptСlientApp
|
||||
throw new Exception(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Post-запрос для получения данных
|
||||
public static T? PostRequestReport<T, U>(string requestUrl, U model)
|
||||
{
|
||||
var json = JsonConvert.SerializeObject(model);
|
||||
var data = new StringContent(json, Encoding.UTF8, "application/json");
|
||||
|
||||
var response = _client.PostAsync(requestUrl, data);
|
||||
|
||||
var result = response.Result.Content.ReadAsStringAsync().Result;
|
||||
|
||||
if (response.Result.IsSuccessStatusCode)
|
||||
{
|
||||
return JsonConvert.DeserializeObject<T>(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -253,8 +253,6 @@ namespace BankYouBankruptClientApp.Controllers
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
|
||||
ViewBag.DataOfClientReport = null;
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
@ -266,15 +264,13 @@ namespace BankYouBankruptClientApp.Controllers
|
||||
throw new Exception("Не авторизованы");
|
||||
}
|
||||
|
||||
APIClient.PostRequest("api/Report/CreateClientReport", new ReportSupportBindingModel()
|
||||
//ViewBag.DataOfClientReport = APIClient.GetRequest<ReportClientViewModelForHTML>($"api/Report/GetDataOfClientReport");
|
||||
|
||||
return View(APIClient.PostRequestReport<ReportClientViewModelForHTML, ReportSupportBindingModel>("api/Report/CreateClientReport", new ReportSupportBindingModel()
|
||||
{
|
||||
DateFrom = dateFrom,
|
||||
DateTo = dateTo
|
||||
});
|
||||
|
||||
ViewBag.DataOfClientReport = APIClient.GetRequest<ReportClientViewModelForHTML>($"api/Report/GetDataOfClientReport");
|
||||
|
||||
return View();
|
||||
}));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -36,16 +36,18 @@ namespace BankYouBankruptRestAPI.Controllers
|
||||
|
||||
//метод генерации отчёта за период по картам клиента
|
||||
[HttpPost]
|
||||
public void CreateClientReport(ReportSupportBindingModel model)
|
||||
public ReportClientViewModelForHTML CreateClientReport(ReportSupportBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_reportClientViewModelForHTML = _reportClientLogic.SaveClientReportToPdfFile(new ReportBindingModel
|
||||
var result = _reportClientLogic.SaveClientReportToPdfFile(new ReportBindingModel
|
||||
{
|
||||
FileName = "Отчёт_по_картам.pdf",
|
||||
DateFrom = model.DateFrom,
|
||||
DateTo = model.DateTo
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user