Tsukanova_I.V. LabWork05_hard #13

Closed
Inohara wants to merge 29 commits from LabWork05_hard into LabWork05
4 changed files with 14 additions and 9 deletions
Showing only changes of commit 9923cec609 - Show all commits

View File

@ -16,12 +16,6 @@ namespace IceCreamShopView
_logger = logger;
_logicI = logicIceCream;
_logicS = logicShop;
LoadData();
}
private void LoadData()
{
}
private void SaveButton_Click(object sender, EventArgs e)

View File

@ -44,7 +44,7 @@ namespace IceCreamShopFileImplement.Implements
public List<OrderViewModel> GetFullList()
{
return source.Orders.Select(x => x.GetViewModel).ToList();
return source.Orders.Select(x => GetViewModel(x)).ToList();
}
public OrderViewModel? Insert(OrderBindingModel model)
@ -82,5 +82,16 @@ namespace IceCreamShopFileImplement.Implements
source.SaveOrders();
return order.GetViewModel;
}
private OrderViewModel GetViewModel(Order order)
{
var viewModel = order.GetViewModel;
var document = source.IceCreams.FirstOrDefault(x => x.Id == order.IceCreamId);
if (document != null)
{
viewModel.IceCreamName = document.IceCreamName;
}
return viewModel;
}
}
}

View File

@ -10,7 +10,7 @@ using System.Xml.Linq;
namespace IceCreamShopFileImplement.Models
{
public class IceCream
public class IceCream : IIceCreamModel
{
public int Id { get; private set; }
public string IceCreamName { get; private set; } = string.Empty;

View File

@ -87,7 +87,7 @@ namespace IceCreamShopFileImplement.Models
if(model.ShopIceCreams.Count > 0)
{
IceCreams = model.ShopIceCreams.ToDictionary(x => x.Key, x => x.Value.Item2);
_shopIceCreams = model.ShopIceCreams;
_shopIceCreams = null;
}
}