public DaoEntity <T> Output <T>(string collection, string key) where T : EntityObject
        {
            var daoEntity = (T)data[collection][key];

            return(DaoEntity.Create(collection, key, daoEntity));
        }
Exemple #2
0
 /// <summary>
 /// Creates or Updates the collection specified entirely.
 /// </summary>
 /// <param name="replacingCollection">The replacing collection.</param>
 /// <returns></returns>
 public IEnumerable <T> Put([FromBody] IEnumerable <T> replacingCollection)
 {
     return(this.daoProvider.Input <T>(replacingCollection
                                       .Select(o => DaoEntity.Create(this.CollectionName, o))));
 }
Exemple #3
0
        /// <summary>
        /// creates a new entity in the specified collection.
        /// </summary>
        /// <param name="creating">The creating.</param>
        /// <returns></returns>
        public T Post([FromBody] T creating)
        {
            var daoEntity = DaoEntity.Create(this.CollectionName, creating);

            return(this.daoProvider.Input(daoEntity).Data);
        }
Exemple #4
0
        /// <summary>
        /// Creates or updates the specified entity by key in the collection.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <param name="updating">The updating.</param>
        /// <returns></returns>
        public T Put(string key, [FromBody] T updating)
        {
            var daoObject = DaoEntity.Create(this.CollectionName, key, updating);

            return(this.daoProvider.Input <T>(daoObject).Data);
        }