//public static CallsModel ToModel(this CallsDto call) //{ // return new CallsModel() // { // CallId = call.CallId, // DestinationNumber = call.DestinationNumber, // Duration = call.Duration, // ExternalPrice = call.ExternalPrice, // LineId = call.LineId, // //Line = call.Line.ToModel(), // Time = call.Time // }; //} //public static CallsDto ToDto(this CallsModel call) //{ // return new CallsDto() // { // CallId = call.CallId, // DestinationNumber = call.DestinationNumber, // Duration = call.Duration, // ExternalPrice = call.ExternalPrice, // LineId = call.LineId, // //Line = call.Line.ToDto(), // Time = call.Time // }; //} public static ClientModel ToModel(this CRMServiceReference.ClientDto client) { if (client == null) { return(null); } return(new ClientModel() { Address = client.Address, ClientId = client.ClientId, ClientTypeId = client.ClientTypeId, ContactNumber = client.ContactNumber, FirstName = client.FirstName, LastName = client.LastName, ClientType = client.ClientType.ToModel(), CallsToCenter = client.CallsToCenter //Payments = client.Payments.Select(p => p.ToModel()).ToList(), //Lines = client.Lines.Select(s => s.ToModel()).ToList() }); }
public static CRMServiceReference.ClientDto ToDto(this ClientModel client) { if (client == null) { return(null); } CRMServiceReference.ClientDto client1 = new CRMServiceReference.ClientDto() { Address = client.Address, ClientId = client.ClientId, ClientTypeId = client.ClientType.ClientTypeId, ContactNumber = client.ContactNumber, FirstName = client.FirstName, LastName = client.LastName, CallsToCenter = client.CallsToCenter //ClientType = client.ClientType.ToDto() //Lines = client.Lines.Select(l => l.ToDto()).ToList(), //Payments = client.Payments.Select(p => p.ToDto()).ToList() }; return(client1); }