1
I need the next one I don’t know if you can do, so the question, I have two classes and in these two classes I possess exactly equal properties, as follows the examples:
public class Cliente
{
public int ID { get; set; }
public string FisicaJuridica { get; set; }
public string NomeRazaoSocial { get; set; }
public string ApelidoNomeFantasia { get; set; }
public string CPFCNPJ { get; set; }
}
public class Fornecedor
{
public int ID { get; set; }
public string FisicaJuridica { get; set; }
public string NomeRazaoSocial { get; set; }
public string ApelidoNomeFantasia { get; set; }
public string CPFCNPJ { get; set; }
}
What I needed to do was something like:
var cliente = ctx.Clientes.Find(01);//Preenche o objeto cliente
var fornecedor = cliente;//Seria algo assim mas sei que é impossivel
What I needed, when trying the above method where I assign the customer to the supplier the properties with the same name received the customer’s values, like:
fornecedor.FisicaJuridica = cliente.FisicaJuridica;
I just need to know if it’s possible, or a better way for me to do it, without having to go propertied by property and assigning values, the classes above are just examples the real ones are giant, it would take a lot of work.