Esempio n. 1
0
        /// <summary>
        /// Updates the entity
        /// </summary>
        /// <returns>True if the entity is updated</returns>
        public async Task <Boolean> UpdateAsync(object entity)
        {
            // Convert object to json
            var    converter = new EntityConverter();
            string json      = converter.ConvertObjectToJson(OriginalEntity, entity, _entityControllerDelegate);

            if (string.IsNullOrEmpty(json))
            {
                //Nothing to update
                return(true);
            }

            // Update entire object
            Boolean returnValue = false;

            // Update and set _originalentity to current entity (_entity)
            if (await _connection.PutAsync(_keyName, _identifier, json))
            {
                returnValue    = true;
                OriginalEntity = Clone(entity);
            }
            return(returnValue);
        }