Ejemplo n.º 1
0
 /// <summary>
 /// Check if object exists
 /// </summary>
 /// <param name="endpoint"></param>
 /// <param name="payload"></param>
 /// <returns></returns>
 public bool Exists(OpenEntity item)
 {
     // TODO: This does not works! returns always false
     //Jsonify the object then get its hash
     return(Storage.Where(
                x => x.Endpoint == item.Endpoint &&
                x.ItemHash == item.ItemHash)?.Count() > 0);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Adds an object to the list
        /// </summary>
        /// <param name="endpoint">data set group name</param>
        /// <param name="payload">Don't know and dont care</param>
        /// <returns></returns>
        public bool Add(string endpoint, dynamic payload)
        {
            var newItem = new OpenEntity()
            {
                Endpoint = endpoint,
                Payload  = payload
            };

            if (!Exists(newItem))
            {
                Storage.Add(newItem);
                return(true);
            }
            return(false);
        }