repo2403/PartnerProductHistoryWindow.axaml.cs
2025-03-24 14:59:01 +03:00

40 lines
1.0 KiB
C#

using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using demka2025_sedelnikov.Context;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Linq;
namespace demka2025_sedelnikov;
public partial class PartnerProductHistoryWindow : Window
{
User8Context context = new User8Context();
public PartnerProductHistoryWindow(int index)
{
InitializeComponent();
LoadData(index);
}
public void LoadData(int index)
{
// ñîáèðàåì çàïèñè ñ ïðîäàæ îò äàííîãî ïàðòíåðà
var partnerProducts = context.Partnerproducts.Where(pp => pp.PartnerId == index)
.Include(p => p.Partner)
.Include(p => p.Product)
.Where(part => part.PartnerId == index)
.Select(p => new
{
p.Product.Articul,
p.Product.ProductName,
p.Quantity,
p.SellDate
})
.ToList();
PartnerProductHistoryLB.ItemsSource = partnerProducts;
}
}