Fix
This commit is contained in:
parent
30b284dda5
commit
5d4ee306ce
@ -8,6 +8,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace AircraftPlantFileImplement.Implements
|
namespace AircraftPlantFileImplement.Implements
|
||||||
{
|
{
|
||||||
@ -36,7 +37,7 @@ namespace AircraftPlantFileImplement.Implements
|
|||||||
public List<OrderViewModel> GetFullList()
|
public List<OrderViewModel> GetFullList()
|
||||||
{
|
{
|
||||||
return _source.Orders
|
return _source.Orders
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => GetViewModel(x))
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,7 +55,7 @@ namespace AircraftPlantFileImplement.Implements
|
|||||||
|
|
||||||
return _source.Orders
|
return _source.Orders
|
||||||
.Where(x => x.Id.Equals(model.Id))
|
.Where(x => x.Id.Equals(model.Id))
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => GetViewModel(x))
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,9 +71,8 @@ namespace AircraftPlantFileImplement.Implements
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _source.Orders
|
return GetViewModel(_source.Orders
|
||||||
.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))
|
.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id)));
|
||||||
?.GetViewModel;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -92,7 +92,7 @@ namespace AircraftPlantFileImplement.Implements
|
|||||||
|
|
||||||
_source.Orders.Add(newOrder);
|
_source.Orders.Add(newOrder);
|
||||||
_source.SaveOrders();
|
_source.SaveOrders();
|
||||||
return newOrder.GetViewModel;
|
return GetViewModel(newOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -110,7 +110,7 @@ namespace AircraftPlantFileImplement.Implements
|
|||||||
|
|
||||||
order.Update(model);
|
order.Update(model);
|
||||||
_source.SaveOrders();
|
_source.SaveOrders();
|
||||||
return order.GetViewModel;
|
return GetViewModel(order);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -125,9 +125,25 @@ namespace AircraftPlantFileImplement.Implements
|
|||||||
{
|
{
|
||||||
_source.Orders.Remove(element);
|
_source.Orders.Remove(element);
|
||||||
_source.SaveOrders();
|
_source.SaveOrders();
|
||||||
return element.GetViewModel;
|
return GetViewModel(element);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Получение модели заказа
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="order"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private OrderViewModel GetViewModel(Order order)
|
||||||
|
{
|
||||||
|
var viewModel = order.GetViewModel;
|
||||||
|
var plane = _source.Planes.FirstOrDefault(x => x.Id == order.PlaneId);
|
||||||
|
if (plane != null)
|
||||||
|
{
|
||||||
|
viewModel.PlaneName = plane.PlaneName;
|
||||||
|
}
|
||||||
|
return viewModel;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ namespace AircraftPlantView
|
|||||||
/// <param name="logger"></param>
|
/// <param name="logger"></param>
|
||||||
/// <param name="planeLogic"></param>
|
/// <param name="planeLogic"></param>
|
||||||
/// <param name="shopLogic"></param>
|
/// <param name="shopLogic"></param>
|
||||||
public FormSell(ILogger logger, IPlaneLogic planeLogic, IShopLogic shopLogic)
|
public FormSell(ILogger<FormSell> logger, IPlaneLogic planeLogic, IShopLogic shopLogic)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
Loading…
Reference in New Issue
Block a user