изменение способа хранения названия изделия в заказе

This commit is contained in:
Мк Игорь 2023-02-17 22:47:16 +04:00
parent f4e845ee60
commit 311a7a0491
4 changed files with 4 additions and 6 deletions

View File

@ -78,7 +78,6 @@ namespace BlacksmithWorkshopView
var operationResult = _logicO.CreateOrder(new OrderBindingModel
{
ManufactureId = Convert.ToInt32(comboBoxManufacture.SelectedValue),
ManufactureName = comboBoxManufacture.Text,
Count = Convert.ToInt32(textBoxCount.Text),
Sum = Convert.ToDouble(textBoxSum.Text)
});

View File

@ -7,7 +7,6 @@ namespace BlacksmithWorkshopContracts.BindingModels
{
public int Id { get; set; }
public int ManufactureId { get; set; }
public string ManufactureName { get; set; } = string.Empty;
public int Count { get; set; }
public double Sum { get; set; }
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;

View File

@ -18,7 +18,10 @@ namespace BlacksmithWorkshopListImplement.Implements
var result = new List<OrderViewModel>();
foreach (var order in _source.Orders)
{
result.Add(order.GetViewModel);
OrderViewModel vm = order.GetViewModel;
var manufacture = _source.Manufactures.Find(x => x.Id == order.Id);
vm.ManufactureName = manufacture?.ManufactureName ?? string.Empty;
result.Add(vm);
}
return result;
}

View File

@ -10,7 +10,6 @@ namespace BlacksmithWorkshopListImplement.Models
{
public int Id { get; private set; }
public int ManufactureId { get; private set; }
public string ManufactureName { get; private set; } = string.Empty;
public int Count { get; private set; }
public double Sum { get; private set; }
public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен;
@ -26,7 +25,6 @@ namespace BlacksmithWorkshopListImplement.Models
{
Id = model.Id,
ManufactureId = model.ManufactureId,
ManufactureName = model.ManufactureName,
Count = model.Count,
Sum = model.Sum,
Status = model.Status,
@ -50,7 +48,6 @@ namespace BlacksmithWorkshopListImplement.Models
{
Id = Id,
ManufactureId = ManufactureId,
ManufactureName = ManufactureName,
Count = Count,
Sum = Sum,
Status = Status,