Exemple #1
0
        public async Task <ConnectionContext> SaveConnection(ConnectionContext connectionContext)
        {
            if (string.IsNullOrEmpty(connectionContext.Id))
            {
                Connection connection = new Connection();
                connection = connectionContext.ConvertToConnection(true);
                var result = await ConnectionEntityService.CreateConnection(connection);

                return(result.ConvertToConnectionContext());
            }
            var update = connectionContext.ConvertToConnection();
            await ConnectionEntityService.Update(update);

            return(connectionContext);
        }
Exemple #2
0
        public async Task <bool> DeleteConnection(ConnectionContext connectionContext)
        {
            if (connectionContext == null)
            {
                return(false);
            }
            Connection connection = connectionContext.ConvertToConnection();
            var        result     = await ConnectionEntityService.Delete(connection.Id.ToString());

            return(result);
        }
Exemple #3
0
        //public async Task<bool> CreateConnection(ConnectionContext connectionContext)
        //{
        //    if (connectionContext == null)
        //        return false;
        //    Connection connection = connectionContext.ConvertToConnection(true);
        //    var result = await ConnectionEntityService.CreateConnection(connection);
        //    return result;
        //}

        public async Task <ConnectionContext> UpdateConnection(ConnectionContext connectionContext)
        {
            if (connectionContext == null)
            {
                return(null);
            }
            Connection connection = connectionContext.ConvertToConnection();
            var        result     = await ConnectionEntityService.Update(connection);

            return(result.ConvertToConnectionContext());
        }