Created
August 22, 2014 11:58
-
-
Save ro31337/569221616e74073f1e15 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CompanyService | |
{ | |
// ... | |
public Delete(long companyId) | |
{ | |
var company = GetById(companyId); | |
company.DeletedAtUtc = DateTimeOffset.Now; | |
database.Companies.Remove(company); // it's like we usually delete | |
database.SaveChanges(); | |
} | |
} | |
public class Company | |
{ | |
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] | |
public long CompanyId { get; set; } | |
public string Name { get; set; } | |
public bool IsDeleted { get; set; } | |
public DateTimeOffset? DeletedAtUtc { get; set; } // property added | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment