Skip to content

Instantly share code, notes, and snippets.

@mgroves
Created July 17, 2014 15:10
Show Gist options
  • Save mgroves/8f3495a91b52e0b18b28 to your computer and use it in GitHub Desktop.
Save mgroves/8f3495a91b52e0b18b28 to your computer and use it in GitHub Desktop.
using System.Data;
using Dapper;
using Ledger.Models.Entities;
namespace Ledger.Models.CommandQuery.Ledgers
{
public class CreateLedgerCommand : ICommand
{
readonly LedgerEntity ledger;
public CreateLedgerCommand(LedgerEntity ledger)
{
this.ledger = ledger;
}
public void Execute(IDbConnection db)
{
db.Execute("INSERT INTO ledgers (ledgerdesc, isactive) VALUES (@LedgerDesc, @IsActive)",
new { ledger.LedgerDesc, ledger.IsActive });
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment