Tsukanova_I.V. LabWork05_hard #13
@ -16,12 +16,6 @@ namespace IceCreamShopView
|
||||
_logger = logger;
|
||||
_logicI = logicIceCream;
|
||||
_logicS = logicShop;
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void SaveButton_Click(object sender, EventArgs e)
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user