Compare Page Revisions
« Older Revision - Back to Page History - Newer 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 = user; } e.UpdatedOn = DateTime.UtcNow; e.UpdatedBy = user; } }
ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.