public int Insert(Ad ad)
 {
     using (IDbConnection dbConnection = connection.Create())
     {
         var adInsert = new AdInsert();
         int newId    = (int)dbConnection.Query <Int64>(adInsert.Query(new { Name = "", Price = ad.Price.Amount })).Single();
         return(newId);
     }
 }
Exemplo n.º 2
0
        public async Task <bool> Insert(Ad ad)
        {
            return(true);

            return(await Task.Run(() =>
            {
                using (IDbConnection dbConnection = connection.Create())
                {
                    var adInsert = new AdInsert();
                    int newId = (int)dbConnection.Query <Int64>(adInsert.Query(new { Name = "", Price = ad.Price.Amount })).Single();
                    return (newId > 0);
                }
            }));
        }