Beispiel #1
0
        public ActionResult Delete(TransferParameters transferParameters)
        {
            ConnectParameters connector = Common.GetConnectParameters(connectionString, container,
                                                                      transferParameters.TargetName);
            DbUtilities dbConn = new DbUtilities();
            string      table  = transferParameters.Table;

            try
            {
                dbConn.OpenConnection(connector);
                if (String.IsNullOrEmpty(table))
                {
                    return(BadRequest());
                }
                dbConn.DBDelete(table);
            }
            catch (Exception)
            {
                return(BadRequest());
            }

            string message = $"{table} has been cleared";

            dbConn.CloseConnection();
            return(Ok(message));
        }
Beispiel #2
0
 public void DeleteTables()
 {
     try
     {
         string info = "";
         _dbConn.OpenWithConnectionString(target);
         foreach (string tableName in DatabaseTables.Names)
         {
             info = $"Deleting table {tableName}";
             _logger.LogInformation(info);
             _queueService.InsertMessage(infoQueue, info);
             _dbConn.DBDelete(tableName);
         }
     }
     catch (Exception ex)
     {
         _logger.LogInformation($"Error deleting tables {ex.ToString()}");
     }
     finally
     {
         _dbConn.CloseConnection();
     }
 }