Пример #1
0
        public InvoiceHeaderDto ToDto()
        {
            var client = new Client(new Code(Client.Code),
                                    new Name(Client.Firstname),
                                    new Name(Client.Lastname),
                                    new Email(Client.Email),
                                    new Phone(Client.Phone),
                                    Client.Birthday,
                                    Client.Rnc,
                                    Client.HomeOrApartment,
                                    Client.City,
                                    Client.Street,
                                    new Country(Client.SelectedCountry, "", ""),
                                    Client.Created,
                                    Client.Status);

            var paymentTerm = new PaymentTerm(new Name(PaymentTerm.Description),
                                              PaymentTerm.DayValue,
                                              PaymentTerm.Created,
                                              PaymentTerm.Status);

            var details = InvoiceDetails.Map(i => new InvoiceDetailDto(
                                                 i.Id,
                                                 i.ProductCode,
                                                 i.ProductDescription,
                                                 i.Qty,
                                                 i.Amount,
                                                 i.TaxPercent));


            return(new InvoiceHeaderDto(Id
                                        , Code
                                        , Ncf
                                        , NumberSequenceId
                                        , Rnc
                                        , Client.Id
                                        , client
                                        , Created
                                        , DueDate
                                        , PaymentTerm.Id
                                        , paymentTerm
                                        , Notes
                                        , TermAndConditions
                                        , Footer
                                        , Discount
                                        , SubTotal
                                        , TaxTotal
                                        , Total
                                        , details.ToImmutableList()
                                        , Created
                                        , Modified
                                        , Status));
        }