Skip to content

Instantly share code, notes, and snippets.

@mxmissile
Last active January 27, 2022 17:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mxmissile/a0beb532ca3a95fb3b19cfcbdd3dbe3b to your computer and use it in GitHub Desktop.
Save mxmissile/a0beb532ca3a95fb3b19cfcbdd3dbe3b to your computer and use it in GitHub Desktop.
EF test
public override async Task<Account> CreateAsync (Account entity, CancellationToken token)
{
var context = new Context();
entity.CreateDate = DateTime.Now;
entity.LastUpdated = DateTime.Now;
if (entity.ParentId == 0) entity.ParentId = 1;
context.Accounts.Add(entity);
await context.SaveChangesAsync();
return entity;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment