Курсач: Война Бесконечности
This commit is contained in:
parent
af14af2496
commit
82308fd351
@ -127,9 +127,10 @@ namespace DatabaseImplement.Implements
|
|||||||
|
|
||||||
|
|
||||||
var cartItems = context.CartItems
|
var cartItems = context.CartItems
|
||||||
.Where(x => x.PurchaseId == model.Id).ToList()
|
.Where(x => x.PurchaseId == purchase.Id).ToList()
|
||||||
.Select(x => x.GetViewModel).ToList();
|
.Select(x => x.GetViewModel).ToList();
|
||||||
|
|
||||||
|
|
||||||
var products = new List<Product>();
|
var products = new List<Product>();
|
||||||
|
|
||||||
foreach (var item in cartItems)
|
foreach (var item in cartItems)
|
||||||
|
@ -9,6 +9,8 @@ using DataModels.Models;
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using MigraDoc.DocumentObjectModel;
|
||||||
|
using MigraDoc.Rendering;
|
||||||
|
|
||||||
namespace RestAPI.Controllers
|
namespace RestAPI.Controllers
|
||||||
{
|
{
|
||||||
@ -132,5 +134,26 @@ namespace RestAPI.Controllers
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
[HttpGet]
|
||||||
|
public byte[] CreateChart(Guid userId)
|
||||||
|
{
|
||||||
|
Document document = new Document();
|
||||||
|
Section section = document.AddSection();
|
||||||
|
|
||||||
|
section.AddParagraph("Столбчатая диаграмма");
|
||||||
|
|
||||||
|
using (MemoryStream stream = new MemoryStream())
|
||||||
|
{
|
||||||
|
PdfDocumentRenderer renderer = new PdfDocumentRenderer(true, PdfSharp.Pdf.PdfFontEmbedding.Always);
|
||||||
|
renderer.Document = document;
|
||||||
|
renderer.RenderDocument();
|
||||||
|
|
||||||
|
// Сохранение документа в MemoryStream
|
||||||
|
renderer.PdfDocument.Save(stream, false);
|
||||||
|
|
||||||
|
// Получение массива байтов из MemoryStream
|
||||||
|
return stream.ToArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,5 +88,6 @@ app.UseHttpsRedirection();
|
|||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
|
|
||||||
app.MapControllers();
|
app.MapControllers();
|
||||||
|
app.UseDeveloperExceptionPage();
|
||||||
|
|
||||||
app.Run();
|
app.Run();
|
@ -12,6 +12,7 @@
|
|||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="8.0.0" />
|
||||||
|
<PackageReference Include="ScottPlot" Version="5.0.37" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
<img src="data:image/png;base64,@Convert.ToBase64String(Model.GetStatistics())" class="card-img-top" alt="Статистика">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<div class="dropdown">
|
<div class="dropdown">
|
||||||
<button class="btn btn-secondary dropdown-toggle" type="button" id="navbarDropdownMenuLink" data-bs-toggle="dropdown" aria-expanded="false">
|
<button class="btn btn-secondary dropdown-toggle" type="button" id="navbarDropdownMenuLink" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
|
@ -41,16 +41,6 @@ namespace WebApp.Pages.User
|
|||||||
purchaseViewModels = APIClient.GetRequest<List<PurchaseViewModel>>(request);
|
purchaseViewModels = APIClient.GetRequest<List<PurchaseViewModel>>(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnGetStatistics()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SendBill()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnPostSendBill(Guid id)
|
public void OnPostSendBill(Guid id)
|
||||||
{
|
{
|
||||||
var UserId = this.GetUserId();
|
var UserId = this.GetUserId();
|
||||||
@ -78,5 +68,15 @@ namespace WebApp.Pages.User
|
|||||||
|
|
||||||
OnGet(null, null);
|
OnGet(null, null);
|
||||||
}
|
}
|
||||||
|
public byte[] GetStatistics()
|
||||||
|
{
|
||||||
|
var UserId = this.GetUserId();
|
||||||
|
if (UserId is null)
|
||||||
|
{
|
||||||
|
OnGet(null, null);
|
||||||
|
}
|
||||||
|
var chart = APIClient.GetRequest<byte[]>($"purchase/createchart?userId={UserId}");
|
||||||
|
return chart;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.6" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.6" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
|
<PackageReference Include="ScottPlot" Version="5.0.37" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
Loading…
Reference in New Issue
Block a user