public async Task <IActionResult> EditDescriptionAsync([FromBody] DbRequest request) { Logger?.LogDebug("'{0}' has been invoked", nameof(EditDescriptionAsync)); var response = new SingleResponse <EditDescription>(); try { var db = await DbService.GetDatabaseAsync(request.Name); var databaseFactory = new SqlServerDatabaseFactory { DatabaseImportSettings = await DbService.GetDatabaseImportSettingsAsync(request.Name) }; if (request.Type == Tokens.TABLE) { var table = db.FindTable(request.Table); if (string.IsNullOrEmpty(request.Column)) { databaseFactory.AddOrUpdateExtendedProperty(table, Tokens.MS_DESCRIPTION, request.FixedDescription); table.Description = request.Description; } else { var column = table.Columns.First(item => item.Name == request.Column); databaseFactory.AddOrUpdateExtendedProperty(table, column, Tokens.MS_DESCRIPTION, request.FixedDescription); column.Description = request.Description; } } else if (request.Type == Tokens.VIEW) { var view = db.FindView(request.View); if (string.IsNullOrEmpty(request.Column)) { databaseFactory.AddOrUpdateExtendedProperty(view, Tokens.MS_DESCRIPTION, request.FixedDescription); view.Description = request.Description; } else { var column = view.Columns.First(item => item.Name == request.Column); databaseFactory.AddOrUpdateExtendedProperty(view, view.Columns.First(item => item.Name == request.Column), Tokens.MS_DESCRIPTION, request.FixedDescription); column.Description = request.Description; } } await DbService.SerializeAsync(db); await DbService.SerializeAsync(databaseFactory.DatabaseImportSettings); } catch (Exception ex) { response.SetError(ex, Logger); } return(response.ToHttpResponse()); }