public static OrderViewModel MapToViewModel(Order order, Employee employee, Client client, Product product, Protocol protocol, Invoice invoice) { var orderVm = new OrderViewModel() { Id = order.Id, Description = order.Description, AcutalFinishDate = order.AcutalFinishDate, OrderPriority = order.OrderPriority, OrderStatus = order.OrderStatus, PlannedFinishDate = order.PlannedFinishDate, StartDate = order.StartDate, Title = order.Title, Client = ClientMapper.MapToViewModel(client), Employee = EmployeeMapper.MapToViewModel(employee), Product = ProductMapper.MapToViewModel(product), }; if (invoice != null) { orderVm.Invoice = InvoiceMapper.MapToViewModel(invoice); } if (protocol != null) { orderVm.Protocol = ProtocolMapper.MapToViewModel(protocol); } return(orderVm); }
public static InvoiceViewModel MapToViewModel(Invoice invoice, Order order, Client client) { return(new InvoiceViewModel() { Id = invoice.Id, AccountNumber = invoice.AccountNumber, DateOfIssue = invoice.DateOfIssue, Description = invoice.Description, InvoiceNumber = invoice.InvoiceNumber, PaymentType = invoice.PaymentType, PaymentWithoutTax = invoice.PaymentWithoutTax, PaymentWithTax = invoice.PaymentWithTax, TaxPayment = invoice.TaxPayment, TaxRate = invoice.TaxRate, Order = OrderMapper.MapToViewModel(order), Client = ClientMapper.MapToViewModel(client) }); }