Compare Page Revisions
« Older Revision - Back to Page History - Current Revision
var i = new Invoice(); i.Created(user);
i.Modified(user);
public partial class Invoice : IAuditable { }
public interface IAuditable { DateTime UpdatedOn { get; set; } string UpdatedBy { get; set; } DateTime CreatedOn { get; set; } string CreatedBy { get; set; } } public static class IAuditableExtension { public static void Audit(this IAuditable e, bool createNew, string byUser) { if (e == null) return; var dtNow = DateTime.UtcNow; if (createNew) { e.CreatedOn = dtNow; e.CreatedBy = byUser; } e.UpdatedOn = DateTime.UtcNow; e.UpdatedBy = byUser; } }
ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.