Ejemplo n.º 1
0
 public Task RemoveFavorite(FavoriteBrewery favorite)
 {
     return Task.Factory.StartNew(() =>
     {
         using (var conn = _connectionFactory.Create(DatabaseName))
         {
             conn.Delete(favorite);
         }
     });
 }
        public Task<FavoriteBrewery> SaveFavorite(int breweryId, string breweryName)
        {
            return Task.Factory.StartNew(() =>
                                             {
                                                 var fave = new FavoriteBrewery
                                                                {
                                                                    Id = ++_lastId,
                                                                    Name = breweryName,
                                                                    BreweryId = breweryId
                                                                };

                                                 _favoriteBreweries.Add(fave);

                                                 return fave;
                                             });
        }
Ejemplo n.º 3
0
        public Task<FavoriteBrewery> SaveFavorite(int breweryId, string breweryName)
        {
            return Task.Factory.StartNew(() =>
            {
                using (var conn = _connectionFactory.Create(DatabaseName))
                {
                    var favorite = new FavoriteBrewery
                    {
                        BreweryId = breweryId,
                        Name = breweryName
                    };

                    conn.Insert(favorite);

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