S
shapper
Hello,
I am updating an Entity as follows:
public void Update(DocumentUI updated) {
Document original = _context.Documents.FirstOrDefault(d =>
d.Id = updated.Id);
original.Title = updated.Title;
original.Published = updated.Published;
original.File = updated.File;
original.CreatedAt = updated.CreatedAt;
_context.SaveChanges();
}
So I have properties of type String, Int32, DateTime, Boolean and Byte
[].
The problem is that object DocumentUI updated contains only values of
the properties that were changed and not the others ...
How can I solve this? Should I make all properties on DocumentUI
nullable and then check for null before doing the map?
Thank You,
Miguel
I am updating an Entity as follows:
public void Update(DocumentUI updated) {
Document original = _context.Documents.FirstOrDefault(d =>
d.Id = updated.Id);
original.Title = updated.Title;
original.Published = updated.Published;
original.File = updated.File;
original.CreatedAt = updated.CreatedAt;
_context.SaveChanges();
}
So I have properties of type String, Int32, DateTime, Boolean and Byte
[].
The problem is that object DocumentUI updated contains only values of
the properties that were changed and not the others ...
How can I solve this? Should I make all properties on DocumentUI
nullable and then check for null before doing the map?
Thank You,
Miguel