0
Use the method below to update a given table:
public int alteraBem(tb_bens itemBem)
{
try
{
using (GestaoAtivoEntities db = new GestaoAtivoEntities())
{
var bem = db.tb_bens.Where(v => v.int_id_bem.Equals(itemBem.int_id_bem)).FirstOrDefault();
bem.txt_tag_rfid = itemBem.txt_tag_rfid;
bem.txt_codigo = itemBem.txt_codigo;
bem.txt_descricao = itemBem.txt_descricao;
bem.txt_modelo = itemBem.txt_modelo;
bem.int_id_local = itemBem.int_id_local;
bem.int_id_obra = itemBem.int_id_obra;
bem.int_id_proprietario = itemBem.int_id_proprietario;
..... aqui vão os campos restantes......
db.SaveChanges();
It would have to create a method to match the contents of objects dynamically, without having to be done manually one by one, with Reflection or something similar?
It may even seem more complicated to create a method than to move line by line, but I would like something like this IgualarConteúdo(origem, destino)
.
I am using classes generated by Entityframework through the database.
Thanks, very simple, thank you!
– Jothaz