public static VendorDetails MapFromObject(Vendor obj, ResponseGenerator responseGenerator) { var materials = new List <MaterialVendorListing>(); foreach (var material in obj.Materials) { materials.Add(MaterialVendorListing.MapFromObject(material)); } return(new VendorDetails() { VendorId = obj.VendorId, Name = obj.Name, ContractStart = obj.ContractStart, ContractEnd = obj.ContractEnd, ContractNumber = obj.ContractNumber, PointOfContact = obj.PointOfContact, PhoneNumber = obj.PhoneNumber, Email = obj.Email, Website = obj.Website, Status = (obj.Active) ? "Active" : "Inactive", Active = obj.Active, Invoices = responseGenerator.GenerateBasicInvoicesList(obj.Invoices), Tickets = responseGenerator.GenerateBasicTicketList(obj.Tickets), Materials = materials }); }
public static TicketBasic MapFromObject(Ticket obj) { return(new TicketBasic() { TicketId = obj.TicketId, Vendor = VendorListing.MapFromObject(obj.Vendor), Account = AccountListing.MapFromObject(obj.Account), Material = MaterialVendorListing.MapFromObject(obj.MaterialVendor), TicketNumber = obj.TicketNumber, Quantity = obj.Quantity, Date = obj.Date, Cost = obj.Cost, Invoice = InvoiceListing.MapFromObject(obj.Invoice) }); }