I've a Windows Forms application and one of my business rules is when i deactivate a customer a DeactivationDateTime is defined with the current date and time.
I'm using Entity Framework and Domain Driven Design.
Should i take a datetime from database or force a correct date and time on the local machine?
public void DeactivateCustomer(int customerId, int userId)
{
Check.ValidId(customerId);
Check.ValidId(userId);
var u = userRepository.GetById(userId);
if (u == null)
throw new EntityNotFoundException(userId);
var c = customerRepository.GetById(id);
if (c == null)
throw new EntityNotFoundException(id);
c.DeactivateData = new DeactivateData(userId, dateTimeProvider.Now);
customerRepository.SaveOrUpdate(c);
}
dateTimeProvider is an Infrastructure interface the is injected by constructor.