Exemple #1
0
        private void ParseAndPopulateDB(string json)
        {
            var o = JObject.Parse(string.Concat("{facts:", json, "}"));

            foreach (var item in (JArray)o["facts"])
            {
                if (!_chuckNorrisService.IsExists((int)item["id"]))
                {
                    _chuckNorrisService.Create(new ChuckNorrisDto()
                    {
                        Id = (int)item["id"],
                        FactDescription = (string)item["fact"],
                        FactDate        = (string)item["date"],
                        Vote            = (int)item["vote"],
                        Points          = (int)item["points"]
                    });
                }
            }
        }