пу пу пу

This commit is contained in:
Галина Федоренко 2024-05-15 10:21:56 +04:00
parent 2b14114195
commit 4786396747
8 changed files with 13 additions and 14 deletions

View File

@ -36,7 +36,7 @@ namespace StorehouseDatabaseImplement.Implements
public List<SaleViewModel> GetFullList()
{
using var context = new StorehouseDatabase();
return context.Sales.Select(x => x.GetViewModel).ToList();
return context.Sales.Include(x => x.Product).Include(x => x.Client).Select(x => x.GetViewModel).ToList();
}
public SaleViewModel? Insert(SaleBindingModel model)

View File

@ -36,7 +36,7 @@ namespace StorehouseDatabaseImplement.Implements
public List<SupplyViewModel> GetFullList()
{
using var context = new StorehouseDatabase();
return context.Supplys.Select(x => x.GetViewModel).ToList();
return context.Supplys.Include(x => x.Product).Include(x => x.Provider).Select(x => x.GetViewModel).ToList();
}
public SupplyViewModel? Insert(SupplyBindingModel model)

View File

@ -11,8 +11,8 @@ using StorehouseDatabaseImplement;
namespace StorehouseDatabaseImplement.Migrations
{
[DbContext(typeof(StorehouseDatabase))]
[Migration("20240513082325_InitialMigra")]
partial class InitialMigra
[Migration("20240515061146_FirstMigration")]
partial class FirstMigration
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)

View File

@ -5,7 +5,7 @@
namespace StorehouseDatabaseImplement.Migrations
{
/// <inheritdoc />
public partial class InitialMigra : Migration
public partial class FirstMigration : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)

View File

@ -48,9 +48,9 @@ namespace StorehouseDatabaseImplement.Models
{
Id = Id,
ClientId = ClientId,
ClientFIO = Client.ClientFIO,
ClientFIO = Client.ClientFIO ?? string.Empty,
ProductId = ProductId,
ProductName = Product.ProductName,
ProductName = Product.ProductName ?? string.Empty,
SaleNum = SaleNum,
};
}

View File

@ -48,9 +48,9 @@ namespace StorehouseDatabaseImplement.Models
{
Id = Id,
ProviderId = ProviderId,
ProviderFIO = Provider.ProviderFIO,
ProviderFIO = Provider.ProviderFIO ?? string.Empty,
ProductId = ProductId,
ProductName = Product.ProductName,
ProductName = Product.ProductName ?? string.Empty,
SupplyNum = SupplyNum,
};
}

View File

@ -91,8 +91,8 @@ namespace StorehouseView
{
var operationResult = _logicO.Create(new SaleBindingModel
{
ProductId = Convert.ToInt32(comboBoxWood.SelectedIndex) + 1,
ClientId = Convert.ToInt32(comboBoxClient.SelectedIndex) + 1,
ProductId = Convert.ToInt32(comboBoxWood.SelectedValue),
ClientId = Convert.ToInt32(comboBoxClient.SelectedValue),
SaleNum = Convert.ToInt32(textBoxCount.Text)
});
if (!operationResult)

View File

@ -91,11 +91,10 @@ namespace StorehouseView
{
var operationResult = _logicO.Create(new SupplyBindingModel
{
ProductId = Convert.ToInt32(comboBoxWood.SelectedIndex) + 1,
ProviderId = Convert.ToInt32(comboBoxClient.SelectedIndex) + 1,
ProductId = Convert.ToInt32(comboBoxWood.SelectedValue),
ProviderId = Convert.ToInt32(comboBoxClient.SelectedValue),
SupplyNum = Convert.ToInt32(textBoxCount.Text)
});
_logicW.ChangeNum((ProductBindingModel)comboBoxWood.SelectedValue, Convert.ToInt32(textBoxCount.Text));
if (!operationResult)
{
throw new Exception("Ошибка при создании заказа. Дополнительная информация в логах.");