products oneProduct = (from p in db.products
where p.number == 640
select p).FirstOrDefault();
or
products oneProduct = db.products.FirstOrDefault(p => p.number == 640);
You can't map instance from DB onto your, just created instance. You can save a reference to DB instance to your, i.e. replace:
products produkt1 = new products(); // points to the first instance
produkt1 = query.FirstOrDefault(...); // now points to the second instance. if this was the last reference, object probably will be deleted by GC soon
To map how you want isn't possible until your class supports this directly, i.e. via some method:
class products
{
public void CloneFrom(products source)
{
this.SomeThing = source.SomeThing;
...
}
}
in most case this is a bad idea, senseless approach.