As am updating the data which is already present in database and that table has the columns like CreatedBy, CreatedDate, ModifiedBy, ModifiedDate. CreatedBy and CreatedDate is inserted when the new row is created but while updating, I don't need to update CreatedBy and CreatedDate and I need to modify only ModifiedBy and ModifiedDate.
As shown in the below code, it will update the CreatedBy as null and CreatedDate as like 01/01/0001 something like this.
_Context.UserProfile.Update(userProfile);
and my model is like,
public class MyModelUserProfile
{
public int Id { get; set; }
public string Email { get; set; }
public string Username { get; set; }
public string FirstName { get; set; }
public string CreatedBy { get; set; }
public string ModifiedBy { get; set; }
}
Is there any way to avoid updating CreatedBy and CreatedDate column? I can do that by getting that particular record by its email id but i don't want to hit the database once again for this.