private OrderWindowModel CreateModelByOrder(Guid orderGuid) { var order = DbOrderWorker.GetOrder(orderGuid); var additionalServices = DbReferenceWorker.GetAdditionalServiceReference(); foreach (var serviceGuid in order.AdditonalServiceGuids) { var service = additionalServices.SingleOrDefault(x => x.Guid == serviceGuid); if (service != null) { service.Checked = true; } } var model = new OrderWindowModel() { OrderGuid = order.Guid, AdditionalServices = additionalServices, Area = order.Area, BeginRentDate = order.RentBeginDate, EndRentDate = order.RentEndDate, Name = order.Name, TotalCost = order.TotalCost ?? 0, Car = order.Car, IsEdit = true }; return(model); }
private OrderWindowModel CreateModelByCar(Guid carGuid) { var model = new OrderWindowModel() { Car = DbCarWorker.GetCar(carGuid), AdditionalServices = DbReferenceWorker.GetAdditionalServiceReference() }; return(model); }
public OrderWindow() { InitializeComponent(); var model = new OrderWindowModel { OrderGuid = Guid.Empty, AdditionalServices = DbReferenceWorker.GetAdditionalServiceReference() }; DataContext = model; }