예제 #1
0
 public Task RemoveFavorite(FavoriteBeer favorite)
 {
     return Task.Factory.StartNew(() =>
     {
         using (var conn = _connectionFactory.Create(DatabaseName))
         {
             conn.Delete(favorite);
         }
     });
 }
        public Task<FavoriteBeer> SaveFavorite(int beerId, string beerName)
        {
            return Task.Factory.StartNew(() =>
                                             {
                                                 var fave = new FavoriteBeer
                                                                {
                                                                    Id = ++_lastId,
                                                                    Name = beerName,
                                                                    BeerId = beerId
                                                                };

                                                 _favoriteBeers.Add(fave);

                                                 return fave;
                                             });
        }
예제 #3
0
        public Task<FavoriteBeer> SaveFavorite(int beerId, string beerName)
        {
            return Task.Factory.StartNew(() =>
            {
                using (var conn = _connectionFactory.Create(DatabaseName))
                {
                    var favorite = new FavoriteBeer
                                       {
                                           BeerId = beerId,
                                           Name = beerName
                                       };

                    conn.Insert(favorite);

                    return favorite;
                }
            });
        }
 public Task RemoveFavorite(FavoriteBeer favorite)
 {
     return Task.Factory.StartNew(() => _favoriteBeers.Remove(favorite));
 }