I have DateTime property to check when the producet is created Or deleted, But when adding a product then DeletedTime has to be null or empty. I know that DateTime is a value type so i could not use null or 0.
public DateTime DeletedTime {get;set} = null (did not work). Also not: public DateTime DeletedTime {get;set} = DateTime.MinValue;
You have to declare the property like this
class Person
{
public DateTime? DeleteDate {get;set;}
}
then you can set in code
Person person = new Person();
person.DeleteDate = null;