public void AddFavoritePlanet(int Id, string URL) { var planetDALModel = new FavoritePlanetDALModel(); planetDALModel.Id = Id; planetDALModel.Url = URL; _fanStore.InsertFavoritePlanet(planetDALModel); }
public bool InsertFavoritePlanet(FavoritePlanetDALModel favoritePlanet) { var sql = $@"INSERT INTO StarWarsFanFavPlanets (Id, Url) VALUES(@{nameof(favoritePlanet.Id)} ,@{nameof(favoritePlanet.Url)})"; using (var connection = new SqlConnection(_config.ConnectionString)) { var result = connection.Execute(sql, favoritePlanet); return(true); } }