public IActionResult DeleteStudent()
        {
            IFirebaseClient client = new FirebaseClient(objFireConfig);
            var             setter = client.Delete("StudentList/" + 2);

            return(Content("Record Deleted !!"));
        }
Ejemplo n.º 2
0
        public override string deleteAll()
        {
            IFirebaseClient client   = new FirebaseClient(config);
            var             response = client.Delete("notes");

            return(response.StatusCode.ToString().ToLower());
        }
Ejemplo n.º 3
0
        public ActionResult Delete(string id)
        {
            IFirebaseClient  client   = new FirebaseClient(config);
            FirebaseResponse response = client.Delete("Students/" + id);

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 4
0
        public static void execute()
        {
            try
            {
                IFirebaseConfig config = new FirebaseConfig
                {
                    AuthSecret = "tqbbj0jnqp04G3LfRzptLBL82pSvBDW374GeXJEl",
                    BasePath   = "https://linzgeoquiz.firebaseio.com"
                };

                IFirebaseClient client = new FirebaseClient(config);


                //var getResponse = client.Get("streets");
                FirebaseResponse          response = client.Get("streets");
                IDictionary <int, Street> streets  = response.ResultAs <IDictionary <int, Street> >();

                Console.WriteLine("Nr. of streets: " + streets.Count);

                foreach (int i in streets.Keys)
                {
                    if (streets[i] == null || string.IsNullOrEmpty(streets[i].is_in) || string.IsNullOrEmpty(streets[i].name) || !streets[i].is_in.ToLower().Contains("linz") || streets[i].is_in.ToLower().Contains("linz-land"))
                    {
                        var deleteResponse = client.Delete("streets/" + i);
                    }
                }
            }
            catch (FirebaseException ex)
            {
                Console.WriteLine(ex.ToString());
                ContentFilter.execute();
            }
        }
Ejemplo n.º 5
0
        public override string delete(int index)
        {
            Note[] allNotes = all();
            if (allNotes.Length <= index)
            {
                return("Index is too large.");
            }
            IFirebaseClient client   = new FirebaseClient(config);
            var             response = client.Delete("notes/" + allNotes[index].Id);

            return(response.StatusCode.ToString().ToLower());
        }
 private void Relase()
 {
     lock (syncLock)
     {
         QueryBuilder builder = QueryBuilder.New($@"equalTo=""{lockReference}""");
         builder.OrderBy("$key");
         FirebaseResponse response = client.Get("locks", builder);
         if (response.StatusCode == System.Net.HttpStatusCode.OK && !response.IsNull())
         {
             client.Delete($"locks/{lockReference}");
         }
     }
 }
Ejemplo n.º 7
0
 public bool Delete(int code)
 {
     try
     {
         String key = GetKeyByCode(code);
         if (String.IsNullOrEmpty(key))
         {
             return(false);
         }
         client.Delete("books/" + key);
         return(true);
     }
     catch { return(false); }
 }
Ejemplo n.º 8
0
        public List <ProductModel> GetFilteredProducts(string link, bool useCache, bool notify)
        {
            const string cacheKey  = "getFilteredProducts";
            var          cachedObj = _cache.Get(cacheKey);

            if (cachedObj != null && useCache)
            {
                return((List <ProductModel>)cachedObj);
            }

            IFirebaseClient client = new FirebaseClient(config);

            client.Delete("Products");             //Deletes all old items, otherwise they will popup

            const string cacheKeyOldProducts = "getFilteredProductsOldList";
            var          cachedObjOldList    = (List <ProductModel>)_cache.Get(cacheKeyOldProducts);

            var products = ScanProducts(link);

            var filteredProducts = new List <ProductModel>();

            foreach (var product in products.Where(a => a.PriceDrop < -49))
            {
                product.IsNew = false;
                var availableProduct = IsProductInStock(product);

                if (cachedObjOldList != null)
                {
                    var existsInOldList = cachedObjOldList.Any(a => a.Id == product.Id);
                    if (availableProduct != null && !existsInOldList)
                    {
                        product.IsNew = true;
                        if (notify)
                        {
                            client.PushAsync("Products", product);
                        }
                    }
                }

                if (availableProduct != null)
                {
                    filteredProducts.Add(product);
                }
            }
            _cache.Put(cacheKey, filteredProducts, new TimeSpan(0, 5, 0));
            _cache.Put(cacheKeyOldProducts, filteredProducts, new TimeSpan(0, 6, 0));

            return(filteredProducts);
        }
Ejemplo n.º 9
0
        public static void UpdateBetAndDeletePending(PlacedBet placedBet, Pending pending)
        {
            try
            {
                var client = new FirebaseClient(_config);

                client.Update(Helper.GetPlacedBetUrl(pending.DatePlaced, pending.CustomId, pending.Sport), placedBet);

                client.Delete($"pending_game_evaluation/{pending.CustomId}");
            }
            catch (Exception e)
            {
                Console.WriteLine("Could not update/delete entries in the database. See error message: " + e.Message);
            }
        }
        public string DeleteFireBaseData(string AuthSecret, string BasePath, string item)
        {
            IFirebaseConfig config = new FirebaseConfig
            {
                AuthSecret = AuthSecret,
                BasePath = BasePath
            };

            IFirebaseClient client = new FirebaseClient(config);

            FirebaseResponse response = client.Delete(item);

            string retorno = JsonConvert.SerializeObject(response).ToString();

            return retorno;
        }
Ejemplo n.º 11
0
        public void ClearLeaderboard()
        {
            var config = new FirebaseConfig
            {
                BasePath = "https://testing-challenge.firebaseio.com/word-statistics/"
            };

            using (var client = new FirebaseClient(config))
            {
                var response = client.Get("");
                var jObject  = JsonConvert.DeserializeObject(response.Body) as JObject;
                foreach (var pair in jObject)
                {
                    client.Delete(pair.Key);
                }
            }
        }
Ejemplo n.º 12
0
 public static bool DeleteMessage(string username)
 {
     client.Delete(userPath + username + messagePath);
     return(true);
 }